Cartographic Label Placer
Give GeoJSON Point, LineString or Polygon features a name and importance. The placer measures text width and height in your browser, generates candidate positions and checks rotated text boxes against other labels, map boundaries and forbidden polygons. Higher-priority names go first; labels that cannot fit remain in an explicit rejection report. Coordinates stay in your browser.
Key features
- Canvas TextMetrics measurements for Arial text and rotated-box collision detection
- Eight point positions, readable line angles and interior polygon candidates
- Rejects candidates crossing exclusion polygons, their holes or the map edge
- Reports rejected names with reason counts and conflicting feature IDs
- Local SVG map, position GeoJSON and JSON collision report downloads
- WGS 84 longitude-latitude input; up to 64 labels, 16 forbidden zones and 1,200 coordinates
How to use
- Use properties.name and a 0–100 properties.priority for each label; mark forbidden Polygons with properties.kind=forbidden.
- Open the example or a GeoJSON file, then set west, south, east and north viewport bounds, pixel dimensions and base font size.
- Run placement and inspect the map, placed names, rejected reasons and approximate map scale.
- Download the SVG map, label-position GeoJSON and collision JSON report separately.
Use cases
- Reduce city and station name overlap on a small map
- Keep river names readable along line direction
- Review names inside a park while excluding reserved areas
- Audit failed label placements before printing
Frequently asked questions
Will every map label be placed?
No. This deterministic greedy placer fixes higher-priority labels first. When all candidates lie outside the map, in a forbidden zone or overlap another label, it reports the rejection. It does not promise a global optimum.
How are line and polygon names positioned?
Line names use segments longer than the measured text and rotate into a readable upright angle. Polygon names use interior candidates; the entire text box must fit inside the outer ring and outside holes.
How accurate is the scale?
Scale is approximate, using spherical distance at the viewport centre and 96 dpi. Placement projects lon/lat linearly onto a rectangle. Antimeridian crossings, polar regions, large extents and survey work are out of scope.
Can exported SVG text change in another viewer?
Yes. Placement measures Arial/sans-serif in this browser. Another SVG renderer may substitute a different font and change the shape, so review the final output environment.
Are files or coordinates sent to a server?
No. Editing, measuring text and creating downloads take place in this browser tab. No external map tiles are loaded.
Privacy
GeoJSON and coordinates are processed in this browser tab only. There is no server upload, external map tile or automatic storage.
Comments & questions