Created
June 14, 2022 00:06
-
-
Save liquidx/d282ced85fee03bef18d06934811ec60 to your computer and use it in GitHub Desktop.
Filter tokyo.geojson to remove all islands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs"); | |
// https://github.com/dataofjapan/land/blob/master/tokyo.geojson | |
const tokyo = JSON.parse(fs.readFileSync("tokyo.geojson")); | |
const tokyoMainland = { | |
type: "FeatureCollection", | |
features: [], | |
}; | |
for (let feature of tokyo.features) { | |
if ( | |
feature && | |
feature.properties && | |
feature.properties.area_ja && | |
feature.properties.area_ja != "島嶼部" && | |
feature.properties.area_ja != "null" | |
) { | |
// not an island | |
tokyoMainland.features.push(feature); | |
} | |
} | |
fs.writeFileSync( | |
"tokyo-mainland.geojson", | |
JSON.stringify(tokyoMainland, null, 0) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment