Open msbarry opened 3 years ago
Here are a few implementations:
The standard approach appears to be:
JTS provides utilities for each of those steps so it should be possible to just piece them together.
another possible approach: https://github.com/micycle1/JMedialAxis
Polygon center lines into can be implemented by leveraging the GeoTools
library. Since PlaneTiler already uses org.geotools:gt-shapefile
and org.geotools:gt-epsg-hsql
. Incorporating the CenterLine::getCenterLine function from the org.geotools:gt-process-geometry
library might be one of the easiest solutions.
Here's how I envision the implementation within PlaneTiler:
import org.geotools.process.geometry.CenterLine;
public Geometry computeCenterLine() {
return CenterLine.getCenterLine(polygonGeometry);
}
Additionally, CenterLine::getCenterLine
also takes density
argument which might be also integrated into similar function.
Currently the basemap profile uses lake centerlines from the unmaintained https://github.com/lukasmartinelli/osm-lakelines repo. It would be nice if flatmap could generate centerlines for polygons itself out of the box. In most cases you would probably want to fall back to a point label if the polygon is not elongated. It might also make sense to limit minzoom based on the length of the line or area of the polygon if it's a point so the entire text fits into the polygon.