view 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
line wrap: on
line source

/*eslint no-unused-vars: ["error", { "args": "none" }]*/
import "ol/ol.css";
import { Map, View } from "ol";
import TileLayer from "ol/layer/Tile";
import OSM from "ol/source/OSM";

export default {
  render(h) {
    return <div id="map" />;
  },
  data() {
    return {
      lat: 52.278889,
      long: 8.043056,
      zoom: 12,
      projection: "EPSG:4326"
    };
  },
  mounted() {
    console.log(this.centerX);
    new Map({
      layers: [
        new TileLayer({
          source: new OSM()
        })
      ],
      target: "map",
      view: new View({
        center: [this.long, this.lat],
        zoom: this.zoom,
        projection: this.projection
      })
    });
  }
};