Skip to main content
100%

Clean Up for Natural Earth GeoJSON

✓ Published0🌍 Public
Mmbostock
Last edited Sep 9, 2012
Created on Sep 9, 2012

This example presents a command-line Node.js script for cleaning Natural Earth GeoJSON data. It reads a GeoJSON collection from standard input and outputs a simplified version, retaining only the `name` property and an `id` derived from either the `ISO_A3` or `FIPS` code. The script uses `JSON.parse` and `JSON.stringify` for data processing, and it rounds all coordinate values to six decimal places via a custom `round` function applied to `Polygon`, `MultiPolygon`, and `LineString` geometries. The process logs warnings for invalid country codes.

AI-generated description

Similar vizzes