39 lines
904 B
JavaScript
39 lines
904 B
JavaScript
import Map from '../src/ol/Map.js';
|
|
import View from '../src/ol/View.js';
|
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
|
import {defaults as defaultInteractions, Modify, Select} from '../src/ol/interaction.js';
|
|
import TileLayer from '../src/ol/layer/Tile.js';
|
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
|
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
|
|
|
|
|
|
const raster = new TileLayer({
|
|
source: new OSM()
|
|
});
|
|
|
|
const vector = new VectorLayer({
|
|
source: new VectorSource({
|
|
url: 'data/geojson/countries.geojson',
|
|
format: new GeoJSON(),
|
|
wrapX: false
|
|
})
|
|
});
|
|
|
|
const select = new Select({
|
|
wrapX: false
|
|
});
|
|
|
|
const modify = new Modify({
|
|
features: select.getFeatures()
|
|
});
|
|
|
|
const map = new Map({
|
|
interactions: defaultInteractions().extend([select, modify]),
|
|
layers: [raster, vector],
|
|
target: 'map',
|
|
view: new View({
|
|
center: [0, 0],
|
|
zoom: 2
|
|
})
|
|
});
|