Create Point Source Based on Polygon Tile Source

My goal is to have labels in the center of polygons.

Currently the polygons are being added via a vector tile source.

In order to have labels centered on polygons, it seems I must add a point source that has geometries representing the polygon centroids. (based on this answer)

When getting geometries via vector tiles, would it possible to dynamically create this point source, or must it be another vector source, one dedicated solely to centroid points?

1 answer

  • answered 2020-10-01 03:47 Steve Bennett

    The usual approach is to generate the labels separately, using geojson-polygon-labels.

    Attempting to do it dynamically would be pretty tricky, although perhaps not impossible.