Mercurial > gemma
comparison client/src/components/Map.jsx @ 123:92e0c636e67c
Upgraded to current Version of OpenLayers
As of v5.0.0 OpenLayers has adapted common conventions
from the JS ecosystem. As the changes fit our current
use case better, an upgrade to v5.0.0 is a good idea.
For more details see upstream:
https://github.com/openlayers/openlayers/releases/tag/v5.0.0
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 27 Jun 2018 12:59:06 +0200 |
parents | 5e95c62a7e74 |
children | dc2a5920b731 |
comparison
equal
deleted
inserted
replaced
122:da279a0ce127 | 123:92e0c636e67c |
---|---|
1 /*eslint no-unused-vars: ["error", { "args": "none" }]*/ | 1 /*eslint no-unused-vars: ["error", { "args": "none" }]*/ |
2 import ol_Map from "ol/map"; | 2 import "ol/ol.css"; |
3 import ol_layer_Tile from "ol/layer/tile"; | 3 import { Map, View } from "ol"; |
4 import ol_source_OSM from "ol/source/osm"; | 4 import TileLayer from "ol/layer/Tile"; |
5 import ol_View from "ol/view"; | 5 import OSM from "ol/source/OSM"; |
6 | 6 |
7 export default { | 7 export default { |
8 render(h) { | 8 render(h) { |
9 return <div id="map" />; | 9 return <div id="map" />; |
10 }, | 10 }, |
16 projection: "EPSG:4326" | 16 projection: "EPSG:4326" |
17 }; | 17 }; |
18 }, | 18 }, |
19 mounted() { | 19 mounted() { |
20 console.log(this.centerX); | 20 console.log(this.centerX); |
21 new ol_Map({ | 21 new Map({ |
22 layers: [ | 22 layers: [ |
23 new ol_layer_Tile({ | 23 new TileLayer({ |
24 source: new ol_source_OSM() | 24 source: new OSM() |
25 }) | 25 }) |
26 ], | 26 ], |
27 target: "map", | 27 target: "map", |
28 view: new ol_View({ | 28 view: new View({ |
29 center: [this.long, this.lat], | 29 center: [this.long, this.lat], |
30 zoom: this.zoom, | 30 zoom: this.zoom, |
31 projection: this.projection | 31 projection: this.projection |
32 }) | 32 }) |
33 }); | 33 }); |