I'm trying to get familiar with creating my custom vector tiles. For this purpose I'm creating a simple world map with country boundaries based on natural earth shapefiles. I'm creating the vector tiles using tippecanoe which I'm later on loading into a browser based mapbox map. I'm able render the country boundaries just fine but I'm struggling with the country labels which should be placed at the center of a feature. After some research I found out that it is not possible to simply add a label to a feature based on some property value since a feature might be cut in half by a tile boundary and therefore it is not possible to find the center of the feature. It seems to be necessary to create a separate layer for labels with only point data instead of lines.

Since I was assuming that this is quite a common problem, my question is whether such datasets are available somewhere or whether they have to be created by hand by calculating country centroids or similar. I was hoping to find something like this based on open streetmap data but I wasn't able to find anything.

Any hint is very welcome!

1 Answer 1


As you already found out, the automatic label placement for your country boundaries has some drawbacks, so generating label points for them gives you more control about where to place the labels:

Here is a nice tool which offers different algorithms for this task:


Or you could use https://qgis.org/ to create label points (e.g. centroids).

Please note that depending on the shape of your geometries, some centroid algorithms will not return a point within the geometry (but you could adjust them, using e.g. QGIS).

For Natural Earth data there are also some label points available, maybe the admin 0 points fit your needs:


Or you could query OSM e.g. with this overpass turbo query: https://overpass-turbo.eu/s/ZR4

  • Thanks a lot for your help and the different pointers. The geojson-polygon-labels tool looks very promising!
    – Flavio
    Nov 8, 2020 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.