From 3d05383151ad7ce44c6297fc46bf5bf8457db7c6 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 18 Mar 2020 23:03:31 -0700 Subject: Replace map with OpenLayers --- modern/src/MainMap.js | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) (limited to 'modern/src') diff --git a/modern/src/MainMap.js b/modern/src/MainMap.js index 0b68d84..1bda966 100644 --- a/modern/src/MainMap.js +++ b/modern/src/MainMap.js @@ -1,40 +1,25 @@ +import 'ol/ol.css'; import React, { Component } from 'react'; -import { Map, TileLayer, Marker, Popup } from 'react-leaflet'; -import { connect } from 'react-redux' -import DivIcon from './leaflet/DivIcon'; +import { connect } from 'react-redux'; +import olms from 'ol-mapbox-style'; const mapStateToProps = state => ({ positions: state.positions }); class MainMap extends Component { - state = { - lat: 0, - lng: 0, - zoom: 3, + componentDidMount() { + olms(this.el, 'https://cdn.traccar.com/map/basic.json'); } render() { - const position = [this.state.lat, this.state.lng] - - const markers = this.props.positions.map(position => - - - - - - - - ); - - return ( - - - {markers} - - ) + const style = { + position: 'relative', + overflow: 'hidden', + width: '100%', + height: '100%' + }; + return
this.el = el} />; } } -- cgit v1.2.3