Mapbox Tiling Service
Beta

Countries and polygon simplification

This example uses Natural Earth Data's country data. This recipe would be good for global extent interaction with country polygons. You would not need highly detailed country borders in this case, so you would use the simplification option in the features configuration to keep the number of nodes small in the final tiles.

{
"version": 1,
"layers": {
"countries": {
"source": "mapbox://tileset-source/{username}/country-polygons",
"minzoom": 0,
"maxzoom": 5,
"features": {
"simplification": 20
}
}
}
}
FieldDescriptionData type
sourceThe source data to use for this layer. Tileset sources are created with the Create a tileset source endpoint of Mapbox Tiling Service (MTS).String
minzoomSpecify the minimum zoom at which your tileset will be available. A value of 0 here ensures that the countries will be visible at a global level.Integer
maxzoomSpecify the maximum zoom at which your tileset will be available. A value of 5 here ensures that the countries will be visible as the user zooms in a little bit, but will not be visible if they zoom in significantly.Integer
features.simplificationSpecify an integer value or expression that is greater than zero to control the level of simplification that occurs for features. The value provided is relative to the extent provided for the tiles, with a larger value resulting in more simplification. A value of 20 here indicates a moderate amount of simplification that will become more apparent as a user zooms in on country boundaries.Integer expression
Was this page helpful?