- 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
_area
property (in m²) - Optionally adds a
tippecanoe
minzoom to each label
npm install --global geojson-polygon-labels
geojson-polygon-labels [--precision=0.001] [--include-area] [--label=polylabel] [--by-feature] [--include-minzoom=0-16] [--verbose] layer.geojson > labels.geojson
--precision
Polylabel precision. Defaults to0.001
since GeoJSON is usually in geographic coordinates.--label
Label placement algorithm. Options arepolylabel
,centroid
,center-of-mass
.--include-area
Adds an_area
property in m².--style
How to place labels for GeometryCollections or Multi* Geometry types. Options areexplode
,largest
,combine
.--include-minzoom
will try to determine a suitable minzoom for the label to appear at and save it in thetippecanoe
key for use in tippecanoe. Value in the form min-max where min is the smallest minzoom and max the largest minzoom.