Create Point Source Based on Polygon Tile Source

257 views Asked by At

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

There are 1 answers

0
Steve Bennett On

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.