polylabel_cmd
…is the command-line version of Polylabel. Install it using cargo install polylabel_cmd, or download a binary and put it on your $PATH.
This gives you the polylabel command.
Use
Polylabel takes one mandatory argument: a file containing valid GeoJSON containing Polygons and / or MultiPolygons to be labelled. They 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.
- Processing of nested
GeometryCollections is supported, but you shouldn't be using those - Empty geometries or collections will be left unaltered
- Non-(
Multi)Polygongeometries cannot be processed – their presence will halt further processing.
You may also pass an optional -t or --tolerance switch, allowing you to fine-tune the tolerance from the default 0.001. Smaller tolerances take longer to calculate.
A -p or --pretty flag may be set, which will pretty-print the GeoJSON output.
Irrespective of input, successful output is a GeoJSON FeatureCollection. Its contents depend on the input geometry:
Polygon: TheFeatureCollectioncontainsPointFeaturesMultiPolygon: TheFeatureCollectioncontainsMultiPointFeaturesGeometryCollection: TheFeatureCollectioncontainsGeometryCollectionFeatures whose collection members arePoints orMultiPoints.
Output features retain the order of input features / geometries, and input feature properties are mapped to output features where they exist.
Progress
If you aren't piping the output of the command to a file, polylabel will display progress of the parsing and labelling steps in the terminal.
Validity
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.
Speed
Polylabel is fast. Polygons are processed in parallel, using Rayon.
Binaries
Pre-built binaries are available from releases. Binaries are available for:
- macOS (x86_64)
- Linux (x86_64)
- Windows (x86_64 and i686)