blob: 1bda9660b8e9899b96105b72897af2d5a8b72f4a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import 'ol/ol.css';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import olms from 'ol-mapbox-style';
const mapStateToProps = state => ({
positions: state.positions
});
class MainMap extends Component {
componentDidMount() {
olms(this.el, 'https://cdn.traccar.com/map/basic.json');
}
render() {
const style = {
position: 'relative',
overflow: 'hidden',
width: '100%',
height: '100%'
};
return <div style={style} ref={el => this.el = el} />;
}
}
export default connect(mapStateToProps)(MainMap);
|