geojson-polygon-labels
geojson-polygon-labels copied to clipboard
Command line tool to generate point labels from GeoJSON polygons
geojson-polygon-labels
- Command line tool to generate point labels from GeoJSON polygons.
- Point and Line features present in the input are ignored.
- Supports GeometryCollections and MultiPolygons with options to label each part, only the largest part, or treat all parts as one.
- Label placement algorithms are polylabel pole of inaccessibility, centroid and center of mass.
- Source feature properties are retained.
- Optionally adds an
_areaproperty (in m²) - Optionally adds a
_bboxproperty ([west, south, east, north]) - Optionally adds a
tippecanoeminzoom to each label
Install
npm install --global geojson-polygon-labels
Command Line
geojson-polygon-labels [--precision=0.001] [--include-area] [--include-bbox] [--label=polylabel] [--style=explode] [--include-minzoom=0-16] [--verbose] layer.geojson > labels.geojson
--precisionPolylabel precision. Defaults to0.001since GeoJSON is usually in geographic coordinates.--labelLabel placement algorithm. Options arepolylabel,centroid,center-of-mass.--include-areaAdds an_areaproperty in m².--include-bboxAdds a_bboxproperty as[west, south, east, north]--styleHow to place labels for GeometryCollections or Multi* Geometry types. Options areexplode,largest,combine.--include-minzoomwill try to determine a suitable minzoom for the label to appear at and save it in thetippecanoekey for use in tippecanoe. Value in the form min-max where min is the smallest minzoom and max the largest minzoom.--ndjsonIndicates input is in ndjson format.