forked from alex3165/react-mapbox-gl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeojson-example.js
More file actions
43 lines (37 loc) · 1.07 KB
/
geojson-example.js
File metadata and controls
43 lines (37 loc) · 1.07 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React, { Component } from "react";
import ReactMapboxGl, { GeoJSONLayer, ScaleControl, ZoomControl } from "react-mapbox-gl";
import geojson from "./geojson.json";
import config from "./config.json";
const { accessToken } = config;
const containerStyle = {
height: "100vh",
width: "100%"
};
export default class GeoJSONExample extends Component {
state = {
popup: null,
center: [ -77.01239, 38.91275 ]
};
render() {
return (
<ReactMapboxGl
style="mapbox://styles/mapbox/light-v8"
accessToken={accessToken}
center={this.state.center}
movingMethod="jumpTo"
containerStyle={{ height: "100vh", width: "100%" }}>
<ScaleControl/>
<ZoomControl/>
<GeoJSONLayer
data={geojson}
circleLayout={{ visibility: "visible" }}
symbolLayout={{
"text-field": "{place}",
"text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"],
"text-offset": [0, 0.6],
"text-anchor": "top"
}}/>
</ReactMapboxGl>
);
}
}