Deprecated: Please use geojson-clipping instead.
Subtract Polygons & MultiPolygons in your GeoJSON files from each other.
$ npm install -g geojson-cli-difference
$ cat world.geojson | geojson-cli-difference water.geojson > land.geojson
A geojson object containing polygons and/or multipolygons is expected via stdin
. This will be the minuend.
Zero or more subtrahends are expected to be specified via positional arguments. Each positional argument may be either
- a path to a geojson file containing polygons and/or multipolygons
- a path to a directory full of geojson files containing polygons and/or multipolygons
The result of performing the subtraction will be written to stdout
as a geojson object.
If no subtrahends are specifed, the minuend will be passed through from stdin
to stdout
unchanged.
Scan each subtrahend filename for something that looks like a stringified geojson bounding box. Examples of matching filenames:
[-10,-10,10,10].json
424242.[-58.5314588,-34.705637,-58.3351249,-34.5265535].geojson
If a bounding box is found in a filename, a comparison is made with the bounding box of the minuend. If there is no overlap, the subtraction process for that subtrahend is short-curcuited, thus avoiding the need to perform the I/O of reading the contents of the file in from disk to memory.
This feature can be used as a performance boost in the case when trying to employ a large number of subtrahends of which only a small percent actually overlap the minuend.
Send any warnings (normally written to stderr
) straight to /dev/null
.
- Deprecate in favor of geojson-clipping
- switch backend to polygon-clipping
- set up CI: travis, coveralls
- performance imprv: don't read in all subtrahends at the same time
- Add option --respect-bboxes-in-filenames
- Allow paths to directories full of geojson files to be used as subtrahends to be given as positional arguemnts
- Allow no-op: calling without specifying any subtrahends
- Initial release