From efe2c2cc2d59be87048ed12a29736a5d9eaf597f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 19 Mar 2020 23:19:34 -0700 Subject: Use raster map in production --- modern/src/MainMap.js | 16 +++++++++++++--- modern/src/MainToolbar.js | 4 ++-- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'modern') diff --git a/modern/src/MainMap.js b/modern/src/MainMap.js index 8b363c9..ff51b56 100644 --- a/modern/src/MainMap.js +++ b/modern/src/MainMap.js @@ -4,6 +4,8 @@ import { connect } from 'react-redux'; import { Map, View } from 'ol'; import { fromLonLat } from 'ol/proj'; import olms from 'ol-mapbox-style'; +import TileLayer from 'ol/layer/Tile'; +import OSM from 'ol/source/OSM'; const mapStateToProps = state => ({ positions: state.positions @@ -15,11 +17,19 @@ class MainMap extends Component { target: this.el, view: new View({ constrainResolution: true, - center: fromLonLat([14.5, 46.05]), - zoom: 3 + center: fromLonLat([25.65, 60.98]), + zoom: 9 }) }); - olms(this.map, 'https://cdn.traccar.com/map/basic.json'); + if (location.hostname === 'localhost') { + olms(this.map, 'https://cdn.traccar.com/map/basic.json'); + } else { + this.map.addLayer( + new TileLayer({ + source: new OSM() + }) + ); + } } render() { diff --git a/modern/src/MainToolbar.js b/modern/src/MainToolbar.js index c5af9d8..6e2e4d6 100644 --- a/modern/src/MainToolbar.js +++ b/modern/src/MainToolbar.js @@ -97,7 +97,7 @@ class MainToobar extends Component { - + @@ -106,7 +106,7 @@ class MainToobar extends Component { - + -- cgit v1.2.3