Skip to content

Commit d0bed12

Browse files
committed
Load data.json with hexagons
1 parent 695980a commit d0bed12

File tree

4 files changed

+52
-3
lines changed

4 files changed

+52
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@
2121
npm-debug.log*
2222
yarn-debug.log*
2323
yarn-error.log*
24+
.env

public/data.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"viewState": {
3+
"latitude": 48.457518769136485,
4+
"longitude": -123.40784847252989,
5+
"zoom": 17.014633278264917,
6+
"pitch": 0,
7+
"bearing": 0,
8+
"maxZoom": 20,
9+
"minZoom": 1,
10+
"width": 850,
11+
"height": 967,
12+
"altitude": 1.5,
13+
"maxPitch": 60,
14+
"minPitch": 0,
15+
"transitionDuration": 0
16+
},
17+
"solid": [
18+
{
19+
"hex": "8b28d1a1ad74fff",
20+
"count": 1.993562262564005,
21+
"colorIndex": 3
22+
},
23+
{
24+
"hex": "8b28d1a12201fff",
25+
"count": 1.993562262564005,
26+
"colorIndex": 4
27+
},
28+
{
29+
"hex": "8d28d1af4c0d2ff",
30+
"count": 0.963468653442753,
31+
"colorIndex": 3
32+
}
33+
],
34+
"clear": [],
35+
"dark": []
36+
}

src/mvt/H3HexagonMVT.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,18 @@ export default function H3HexagonMVT () {
6868
}
6969
}, [location])
7070
const [listeners, dispatchListenersAction] = useReducer(listenersReducer, {})
71+
useEffect(() => {
72+
async function fetchData() {
73+
const response = await fetch(process.env.PUBLIC_URL + '/data.json')
74+
const data = await response.json()
75+
console.log('Jim data', data)
76+
setDataSolid(data.solid)
77+
setDataClear(data.clear)
78+
setDataDark(data.dark)
79+
setViewState(data.viewState)
80+
}
81+
fetchData()
82+
}, [setDataSolid, setDataClear, setDataDark, setViewState])
7183

7284
function getDataAndSetter (layer) {
7385
let data

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3403,9 +3403,9 @@ caniuse-api@^3.0.0:
34033403
lodash.uniq "^4.5.0"
34043404

34053405
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001036:
3406-
version "1.0.30001038"
3407-
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001038.tgz#44da3cbca2ab6cb6aa83d1be5d324e17f141caff"
3408-
integrity sha512-zii9quPo96XfOiRD4TrfYGs+QsGZpb2cGiMAzPjtf/hpFgB6zCPZgJb7I1+EATeMw/o+lG8FyRAnI+CWStHcaQ==
3406+
version "1.0.30001441"
3407+
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001441.tgz"
3408+
integrity sha512-OyxRR4Vof59I3yGWXws6i908EtGbMzVUi3ganaZQHmydk1iwDhRnvaPG2WaR0KcqrDFKrxVZHULT396LEPhXfg==
34093409

34103410
capture-exit@^2.0.0:
34113411
version "2.0.0"

0 commit comments

Comments
 (0)