Skip to content

Commit 829a51c

Browse files
committed
Fix types
1 parent aeeea93 commit 829a51c

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

web/src/app/map/utils.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { geojson as flatgeobuf } from "flatgeobuf";
1+
import { IGeoJsonFeature, geojson as flatgeobuf } from "flatgeobuf";
22

33
export function fbgBbox(map: any) {
44
const { lng, lat } = map.getCenter();
@@ -17,25 +17,31 @@ export function fbgBbox(map: any) {
1717

1818
export async function getFgbData(map: any) {
1919
let i = 0;
20-
const geojson = { type: "FeatureCollection", features: [] };
20+
const geojson = { type: "FeatureCollection", features: [] as any[] };
2121

2222
const iter = flatgeobuf.deserialize(
2323
"https://storage.googleapis.com/osm-tardis/2013-02-03T15%3A00.fgb",
2424
fbgBbox(map),
25-
);
25+
) as AsyncGenerator<IGeoJsonFeature>;
2626

2727
const timestamps = new Set();
2828

2929
for await (const feature of iter) {
30+
const { properties } = feature;
31+
32+
if (!properties || properties === null || properties === undefined) {
33+
continue;
34+
}
35+
3036
if (
31-
feature.properties.type !== "relation" &&
32-
(feature.properties.changeType === "added" ||
33-
feature.properties.changeType === "modifiedNew" ||
34-
feature.properties.changeType === "deletedNew")
37+
properties.type !== "relation" &&
38+
(properties.changeType === "added" ||
39+
properties.changeType === "modifiedNew" ||
40+
properties.changeType === "deletedNew")
3541
) {
36-
geojson.features = geojson.features.concat({ ...feature, id: i });
42+
geojson.features.push({ ...feature, id: i });
3743
i += 1;
38-
timestamps.add(feature.properties.timestamp);
44+
timestamps.add(properties.timestamp);
3945
}
4046
}
4147

0 commit comments

Comments
 (0)