aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modern/src/MainMap.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/modern/src/MainMap.js b/modern/src/MainMap.js
index 1bda9660..8b363c9b 100644
--- a/modern/src/MainMap.js
+++ b/modern/src/MainMap.js
@@ -1,6 +1,8 @@
import 'ol/ol.css';
import React, { Component } from 'react';
import { connect } from 'react-redux';
+import { Map, View } from 'ol';
+import { fromLonLat } from 'ol/proj';
import olms from 'ol-mapbox-style';
const mapStateToProps = state => ({
@@ -9,7 +11,15 @@ const mapStateToProps = state => ({
class MainMap extends Component {
componentDidMount() {
- olms(this.el, 'https://cdn.traccar.com/map/basic.json');
+ this.map = new Map({
+ target: this.el,
+ view: new View({
+ constrainResolution: true,
+ center: fromLonLat([14.5, 46.05]),
+ zoom: 3
+ })
+ });
+ olms(this.map, 'https://cdn.traccar.com/map/basic.json');
}
render() {