Skip to content

Commit c9fba30

Browse files
committed
Merge branch 'fix/pbfgeojson' into 'main'
fix: parse some geojson properties and handle missing river basin See merge request natural-solutions/geonature/zones-humides/atlas!11
2 parents 8e91616 + 67b7e17 commit c9fba30

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/lib/utils.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,17 @@ export const pbfToGeojson = (pbfData) => {
55
const pbf = new Pbf(pbfData);
66
const geojson = geobuf.decode(pbf);
77

8+
geojson.features.forEach(element => {
9+
element.properties.bassin_versant = JSON.parse(element.properties.json_arrays)["bassin_versant"];
10+
element.properties.communes = JSON.parse(element.properties.json_arrays)["communes"];
11+
element.properties.criteres_delim= JSON.parse(element.properties.json_arrays)["criteres_delim"];
12+
});
13+
14+
geojson.features.forEach(element => {
15+
if (element.properties.bassin_versant.includes(null)) {
16+
element.properties.bassin_versant = 'Pas de bassin versant attribué';
17+
}
18+
})
19+
820
return geojson
921
}

0 commit comments

Comments
 (0)