Skip to content

Instantly share code, notes, and snippets.

@liquidx
Created June 14, 2022 00:06
Show Gist options
  • Save liquidx/d282ced85fee03bef18d06934811ec60 to your computer and use it in GitHub Desktop.
Save liquidx/d282ced85fee03bef18d06934811ec60 to your computer and use it in GitHub Desktop.
Filter tokyo.geojson to remove all islands
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