---
title: "Masking features in MapTiler | Guides | Map design"
description: "Highlight specific countries by masking other vector features."
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Masking features in MapTiler

Masking vector features on the map is a common cartography task. This page explains step by step how to highlight a particular country by masking others using the MapTiler Map Designer and the Countries tileset.

## Add the Satellite and Countries data sources

Create a new empty map from your MapTiler account, and select the Satellite tileset in the data sources window. Add the Countries tileset data source the same way as Satellite.

![countries\_mask\_1.png](./17735307505937_1e251ef5ca.webp)

## Add the layers

Add the **satellite** (Satellite data source with layer _Satellite_) and **countries** (Countries data source with layer _administrative_) layers.

![countries\_mask\_3.png](./17735307506833_20644e6830.webp)

![countries\_mask\_4.png](./17735307507729_462d327340.webp)

In the Style tab, it will appear as black by default, as shown below, and we are going to style it better in the next step.

![countries\_mask\_5.png](./17735307508369_9fe0a22d4a.webp)

## Style countries with an expression

In the **countries** layer, in the Data tab, set the filters _iso\_a2 != FR_ and _level = 0_

![countries\_mask\_6.png](./17735307508881_9040a0a615.webp)

Set the color of the **countries** layer (in the Style tab) to white (#FFFFFF) and opacity to 65%. All countries except France will appear as semi-transparent white. You can, of course, select another country of interest using a different country code (use the Data tab to find out) and adjust colors as desired.

![countries\_mask\_7.png](./17735261253009_7117e3bea2.webp)

## Highlight the selected country

It is possible to highlight France a bit further using the Countries tileset again. Right-click on the **countries** layer and select Duplicate. Rename (right-click on, for now, **countries copy**) the new layer to the **France border**. Adjust filter to _iso\_a2 = FR_.

![countries\_mask\_8.png](./17735261254033_5e997fc5c1.webp)

In the Style tab, switch the Visualization value to Line. Set the Width to 2px and Blur to 3px.

![countries\_mask\_9.png](./17735307511441_a3153e9660.webp)

The country name label may also be overlayed using MapTiler Planet data source and _place_ layer with filter _iso\_a2 = FR_.

![countries\_mask\_11.png](./17735307511953_d760624619.webp)

Set up Visualization on Symbol, Fill Color on #FFFFFF and Outline Color on #000000.

![](./17735292837137_00ffcf963d.webp)

## Text label masking (experimental)

It is possible to add more labels to the map, let’s say for every French city, and to mask them according to the shape of the country. From a new symbol layer, use a filter with an `within` expression including the GeoJSON description of the country polygon. The latter will render labels only for points being inside that polygon, so that would mask all labels outside France in our example.

```json
"filter": [
      "all",
      ["==", ["geometry-type"], "Point"],
      ["==", ["get", "class"], "city"],
      [
        "within",
        {
          "type": "Feature",
          "geometry": {
            "type": "Polygon",
            "coordinates": [[
            [x,y],
            [x,y],
            [x,y],
            .....
            ]]
          },
          "properties": {}
        }
    ]
]
```

The more the GeoJSON describes a complex shape, the more the map performance decreases.

## Next steps

Continue to [Contours and mountain peaks in feet](https://docs.maptiler.com/guides/map-design/contours-and-mountain-peaks-in-feet/) to learn how to switch contour lines and mountain peaks from meters to feet in your MapTiler map.

## Useful links

[MapTiler Tiles - Satellite](https://cloud.maptiler.com/tiles/satellite/)  
[MapTiler Tiles - Countries](https://cloud.maptiler.com/tiles/countries/)  
[MapTiler Tiles - Planet](https://cloud.maptiler.com/tiles/v4/)  
[MapTiler Countries dataset](https://docs.maptiler.com/guides/map-tiling-hosting/data-hosting/maptiler-countries-dataset)  
[MapTiler Countries](https://www.maptiler.com/countries/)  
[MapTiler Countries schema](https://docs.maptiler.com/schema/countries/)  
[Join MapTiler Countries with your own custom data and make a choropleth map](https://docs.maptiler.com/sdk-js/examples/countries-with-own-data/)  
[How to highlight specific countries on your map](https://docs.maptiler.com/guides/map-design/how-to-highlight-specific-country-on-your-map)  
[How to style a choropleth map in the Map Designer](https://docs.maptiler.com/sdk-js/examples/countries-with-own-data/)
