Update modify features example

This commit is contained in:
Tim Schaub
2022-01-07 13:39:46 -07:00
parent 22609f7a7d
commit a64102f097

View File

@@ -1,21 +1,19 @@
import GeoJSON from '../src/ol/format/GeoJSON.js'; import GeoJSON from '../src/ol/format/GeoJSON.js';
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import VectorLayer from '../src/ol/layer/Vector.js';
import VectorSource from '../src/ol/source/Vector.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import { import {
Modify, Modify,
Select, Select,
defaults as defaultInteractions, defaults as defaultInteractions,
} from '../src/ol/interaction.js'; } from '../src/ol/interaction.js';
import {OSM, Vector as VectorSource} from '../src/ol/source.js'; import {fromLonLat} from '../src/ol/proj.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
const raster = new TileLayer({
source: new OSM(),
});
const vector = new VectorLayer({ const vector = new VectorLayer({
background: 'white',
source: new VectorSource({ source: new VectorSource({
url: 'data/geojson/countries.geojson', url: 'https://openlayers.org/data/vector/us-states.json',
format: new GeoJSON(), format: new GeoJSON(),
wrapX: false, wrapX: false,
}), }),
@@ -31,10 +29,10 @@ const modify = new Modify({
const map = new Map({ const map = new Map({
interactions: defaultInteractions().extend([select, modify]), interactions: defaultInteractions().extend([select, modify]),
layers: [raster, vector], layers: [vector],
target: 'map', target: 'map',
view: new View({ view: new View({
center: [0, 0], center: fromLonLat([-100, 38.5]),
zoom: 2, zoom: 4,
}), }),
}); });