I'd like to show place labels (cities and towns) only for the one country. Is it possible to achieve this in Maputnik editor? I'm looking for something like Mapbox "iso_3166_1" parameter. I've tried to add iso_a2 to the layer filter settings in such way:

"id": "place_city",
"filter": [
   ["==", "$type", "Point"],
   ["==", "class", "city"],
   ["==", "iso_a2", "FR"]

but it didn't work.

  • 1
    Do you have attribute "iso_a2" as an attribute in your vector tiles?
    – user30184
    Commented Jun 22, 2020 at 19:50
  • No, I want to filter style.json generated in maputnik editor. It is not my style but one of the default styles ("dark matter") and it has openmaptiles as source. Openmaptiles seems to have this iso_a2 property as indicated here openmaptiles.org/schema/#place but I can't understand how to activate it. Commented Jun 23, 2020 at 9:04

1 Answer 1


In general your filter is fine (there's a missing bracket ] to close the array), but the filter doesn't give the result you want because there is only one feature with the iso_a2 property for whole France in the source vector tiles (OpenMapTiles).

As stated in the OpenMapTiles docs, the iso_a2 property is a

Two-letter country code ISO 3166-1 alpha-2. Original value of the country_code_iso3166_1_alpha_2 tag.

https://wiki.openstreetmap.org/wiki/Tag:place%3Dcountry states that this tag is useful but currently not part of map features.

In fact there is only one feature available in OSM with country_code_iso3166_1_alpha_2=FR and only this feature with class=country is available for filtering:



Screenshot Maputnik

However, if you want to show labels only for one country, you could try to use a filter with the within expression and a GeoJSON of the country geometry.

Here es an example how such a filter would look like:


Sample geometry used for this filter:


Please note that this filter is currently not working with https://maputnik.github.io/editor because the GL JS version used for Maputnik v1.7.0 has a bug with nested within expressions in filters.

If you don't want to wait for the next release (v1.8.0) of Maputnik to try the filter out, you could build Maputnik yourself from master or use this codesandbox:



Here is also a filter which uses only a within exression so this one works with Maputnik v1.7.0 which is currently available on https://maputnik.github.io/editor:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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