GeoJSON_D3
D3 expects the rings of input Polygons to be oriented in a different order than the GeoJSON RFC 7946 specification, which can lead to unexpected errors. This binary converts RFC 7946
-compliant input containing Polygons and / or MultiPolygons to D3-compliant ring orientation.
Install it using cargo install geojson_d3
, or download a binary and put it on your $PATH.
This provides the geojson_d3
command.
geojson_d3
takes one mandatory argument: a file containing valid GeoJSON. Polygon and / or MultiPolygon geometries can be included as a Feature,
or a Geometry
, or aFeatureCollection
or GeometryCollection
– you may also mix the two geometries in a FeatureCollection
or GeometryCollection
.
GeometryCollection
s is supported, but you shouldn't be using thoseD3
" format will be left unalteredYou may also pass:
- -p
or --pretty
, which will pretty-print the GeoJSON output
- -s
or --stats-only
, which will output the number of labelled polygons, but will not output GeoJSON.
If you aren't piping the output of the command to a file, geojson_d3
will display progress of the parsing and processing steps in the terminal, as well as a final count of the processed (Multi)Polygons.
While the structure of the input GeoJSON is validated, individual geometries are not validated in the DE-9IM sense. If they self-intersect, have open rings etc., results are not guaranteed to be correct.
I haven't benchmarked it, and don't intend to. Serde-JSON
is fast, though, and geometries are processed in parallel. Expect an order-of-magnitude improvement over similar JS-based tools.
Pre-built binaries are available from releases. Binaries are available for: - macOS (x8664) - Linux (x8664) - Windows (x86_64 and i686)