aboutsummaryrefslogtreecommitdiff
path: root/modern/src/MainMap.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-03-19 23:19:34 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-03-19 23:19:34 -0700
commitefe2c2cc2d59be87048ed12a29736a5d9eaf597f (patch)
tree0c579b38e54a6e446a5618c4da88d6320b19c7fb /modern/src/MainMap.js
parent889bc0667e21d1154ac2749842696aac0812ef8c (diff)
downloadtrackermap-web-efe2c2cc2d59be87048ed12a29736a5d9eaf597f.tar.gz
trackermap-web-efe2c2cc2d59be87048ed12a29736a5d9eaf597f.tar.bz2
trackermap-web-efe2c2cc2d59be87048ed12a29736a5d9eaf597f.zip
Use raster map in production
Diffstat (limited to 'modern/src/MainMap.js')
-rw-r--r--modern/src/MainMap.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/modern/src/MainMap.js b/modern/src/MainMap.js
index 8b363c9b..ff51b56e 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() {