- Command line tool to generate point labels from GeoJSON polygons.
- Point and Line features present in the input are ignored.
- geojson-flatten is used to get separate point labels for MultiPolygons and GeometryCollections.
- Label placement algorithms supported are polylabel pole of inaccessibility, centroid and center of mass.
- Original properties are retained.
- Optionally add an
_area
property (in m²) which is designed to aid in selecting which labels to show/hide based on the zoom level.
npm install
geojson-polygon-labels [--precision=0.001] [--include-area] [--label=polylabel] [--by-feature] [--verbose] layer.geojson > labels.geojson
Defaults to 0.001
precision since GeoJSON is usually in geographic coordinates.
--label
options are polylabel
, centroid
, center-of-mass
. Pass the --by-feature
flag to get one point per GeoJSON feature.