Skip to content

Commit 1be724a

Browse files
committed
geojson
1 parent 2821ab0 commit 1be724a

File tree

1 file changed

+154
-1
lines changed

1 file changed

+154
-1
lines changed

src/components/Map6/index.jsx

+154-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,143 @@ import MapContainer from '../MapContainer'
66
let map = null;
77
let marker = null;
88

9+
export const geoJSON = {
10+
"type": "FeatureCollection",
11+
"features": [
12+
{
13+
"type": "Feature",
14+
"properties": {},
15+
"geometry": {
16+
"type": "Polygon",
17+
"coordinates": [
18+
[
19+
[
20+
-88.24218749999999,
21+
15.728813770533966
22+
],
23+
[
24+
-89.219970703125,
25+
15.0827316716058
26+
],
27+
[
28+
-89.241943359375,
29+
14.859850400601037
30+
],
31+
[
32+
-89.176025390625,
33+
14.615478234145261
34+
],
35+
[
36+
-89.373779296875,
37+
14.43468021529728
38+
],
39+
[
40+
-89.14306640625,
41+
14.275030445572817
42+
],
43+
[
44+
-88.41796875,
45+
13.891411092746115
46+
],
47+
[
48+
-87.835693359375,
49+
13.880745842025602
50+
],
51+
[
52+
-87.791748046875,
53+
13.378931658431565
54+
],
55+
[
56+
-87.62695312499999,
57+
13.165073873513025
58+
],
59+
[
60+
-87.4072265625,
61+
12.95102921601837
62+
],
63+
[
64+
-86.9677734375,
65+
12.97244201057838
66+
],
67+
[
68+
-86.890869140625,
69+
13.239945499286312
70+
],
71+
[
72+
-86.671142578125,
73+
13.31479411223821
74+
],
75+
[
76+
-86.72607421875,
77+
13.742053062720384
78+
],
79+
[
80+
-86.341552734375,
81+
13.742053062720384
82+
],
83+
[
84+
-86.15478515625,
85+
14.040672893673618
86+
],
87+
[
88+
-85.869140625,
89+
13.870080100685891
90+
],
91+
[
92+
-85.133056640625,
93+
14.211138758545793
94+
],
95+
[
96+
-85.045166015625,
97+
14.551684056143447
98+
],
99+
[
100+
-84.891357421875,
101+
14.796127603627053
102+
],
103+
[
104+
-84.5068359375,
105+
14.604847155053898
106+
],
107+
[
108+
-84.122314453125,
109+
14.71113475887066
110+
],
111+
[
112+
-83.199462890625,
113+
15.093339268117337
114+
],
115+
[
116+
-84.19921875,
117+
15.834535741221565
118+
],
119+
[
120+
-85.067138671875,
121+
16.06692895745012
122+
],
123+
[
124+
-85.80322265625,
125+
16.003575733881327
126+
],
127+
[
128+
-86.802978515625,
129+
15.813395760460585
130+
],
131+
[
132+
-87.747802734375,
133+
15.908508237156719
134+
],
135+
[
136+
-88.24218749999999,
137+
15.728813770533966
138+
]
139+
]
140+
]
141+
}
142+
}
143+
]
144+
};
145+
9146
const Map6 = () => {
10147

11148
Mapbox.accessToken = process.env.MAPBOX_API_KEY;
@@ -18,7 +155,23 @@ const Map6 = () => {
18155
style: 'mapbox://styles/mapbox/streets-v11',
19156
zoom: 5,
20157
center: [12.492285, 41.890466]
21-
})
158+
})
159+
.on('load', () => {
160+
map.addSource('honduras', {
161+
type: 'geojson',
162+
data: geoJSON, // variablen med geojson-data
163+
});
164+
map.addLayer({
165+
id: 'honduras-layer',
166+
type: 'fill',
167+
source: 'honduras', // samme som id fra addSource
168+
layer: {}, // tomt, ønsker ikke å endre
169+
paint: {
170+
'fill-color': '#00c',
171+
'fill-opacity': 0.2,
172+
}
173+
});
174+
});
22175

23176
}, []);
24177

0 commit comments

Comments
 (0)