Newer
Older
import VectorLayer from 'ol/layer/Vector';
import VectorSource from 'ol/source/Vector';
import ImageLayer from 'ol/layer/Image';
import GeoJSON from 'ol/format/GeoJSON';
import {Circle as CircleStyle, Fill, Stroke, Style, Text, Icon} from 'ol/style';
import MapProperties from './MapProperties';
import GeoTIFFSource from 'ol/source/GeoTIFF';
import ImageStatic from 'ol/source/ImageStatic';
import TileLayer from 'ol/layer/WebGLTile';
import colormap from 'colormap';
import axios from 'axios';
import Projection from 'ol/proj/Projection';
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
private layer: any = new ImageLayer();
private mapProperties: MapProperties;
constructor(mapProperties: MapProperties){
this.mapProperties = mapProperties;
var tilesInfoUrl: string = "http://127.0.0.1:42000/raster?years=2010-2018&ramp=[[255,255,255,1],[255,244,191,1],[255,233,128,1],[255,221,64,1],[255,210,0,1],[243,105,0,1],[230,0,0,1],[153,0,0,1],[77,0,0,1],[0,0,0,1]]";
/*
axios(tilesInfoUrl)
.then(res=>{
var meta: JSON = res.data; */
/* const extent = [0, 0, 1024, 968];
const projection = new Projection({
code: 'xkcd-image',
units: 'pixels',
extent: extent,
});
let source = new ImageStatic({
attributions: '© <a href="https://xkcd.com/license.html">xkcd</a>',
url: 'https://imgs.xkcd.com/comics/online_communities.png',
projection: projection,
imageExtent: extent,
}) */
axios.get(tilesInfoUrl, {
headers: {'Access-Control-Allow-Origin': '*'}
}).then(resp => {
console.log("TILES INFO LOADED");
/* let source = new GeoTIFFSource({
sources: [{
url: tilesInfoUrl,
bands: [0],
min: 0,
nodata: 0,
max: 65535
}]
})
this.layer.setSource(source); */
});
}
public getLayer(): any{
return this.layer;
}