Files
openlayers/rendering/cases/multiple-layers/main.js
2019-05-05 13:24:46 +02:00

47 lines
1.1 KiB
JavaScript

import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import {Vector as VectorLayer, Tile as TileLayer} from '../../../src/ol/layer.js';
import {Vector as VectorSource, XYZ} from '../../../src/ol/source.js';
import GeoJSON from '../../../src/ol/format/GeoJSON.js';
import {Style, Stroke} from '../../../src/ol/style.js';
import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js';
const map = new Map({
layers: [
new TileLayer({
source: new XYZ({
url: '/data/tiles/satellite/{z}/{x}/{y}.jpg',
maxZoom: 3
})
}),
new VectorLayer({
zIndex: 1,
style: new Style({
stroke: new Stroke({
color: 'rgba(255,255,255,0.5)',
width: 0.75
})
}),
source: new VectorSource({
url: '/data/countries.json',
format: new GeoJSON()
})
})
],
target: 'map',
view: new View({
center: [0, 0],
zoom: 2
})
});
const unmanaged = new VectorLayer({
source: new VectorSource({
features: [new Feature(new Point([0, 0]))]
})
});
unmanaged.setMap(map);
render();