view client/src/views/Map.jsx @ 30:7ba0a77fd679

ol component added
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 25 Jun 2018 18:05:50 +0200
parents
children
line wrap: on
line source

/*eslint no-unused-vars: ["error", { "args": "none" }]*/
import ol_Map from "ol/map";
import ol_layer_Tile from "ol/layer/tile";
import ol_source_OSM from "ol/source/osm";
import ol_View from "ol/view";

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 ol_Map({
      layers: [
        new ol_layer_Tile({
          source: new ol_source_OSM()
        })
      ],
      target: "map",
      view: new ol_View({
        center: [this.long, this.lat],
        zoom: this.zoom,
        projection: this.projection
      })
    });
  }
};