filter_layer
Apply a MapLibre filter expression to a map layer and its sub-layers, showing only features that match the specified attribute conditions.
Instructions
Apply a MapLibre filter expression to a layer and all its sub-layers.
📚 AVAILABLE DATA LAYERS & USAGE CONTEXT
Available Data Layers
You have access to map visualization tools that can display geospatial data layers.
Note: These layer definitions can be customized by setting the MCP_MAP_SYSTEM_PROMPT environment variable with your own layer information.
Base Layers (Raster)
OpenStreetMap Standard
ID:
osmType: Raster
URL:
https://tile.openstreetmap.org/{z}/{x}/{y}.pngAttribution:
© OpenStreetMap contributorsDescription: Standard OpenStreetMap tiles with streets, labels, and geographic features
OpenStreetMap Humanitarian
ID:
osm-humanitarianType: Raster
URL:
https://tile-{s}.openstreetmap.fr/hot/{z}/{x}/{y}.pngSubdomains:
a,b,cAttribution:
© OpenStreetMap contributors, Tiles courtesy of Humanitarian OpenStreetMap TeamDescription: High-contrast humanitarian style, good for overlaying data
CartoDB Positron (Light)
ID:
carto-lightType: Raster
URL:
https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.pngSubdomains:
a,b,c,dAttribution:
© OpenStreetMap contributors © CARTODescription: Light grayscale base map, excellent for data visualization
Esri World Imagery
ID:
esri-satelliteType: Raster
URL:
https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}Attribution:
Tiles © EsriDescription: High-resolution satellite imagery
Vector Data Layers
World Database on Protected Areas (WDPA)
ID:
wdpaType: Vector
URL:
pmtiles://https://s3-west.nrp-nautilus.io/public-wdpa/WDPA_Dec2025.pmtilesSource Layer:
wdpaDescription: Global protected areas dataset with IUCN categorization and management information
Attributes:
IUCN_CAT: IUCN management category (Ia=Strict Nature Reserve, Ib=Wilderness Area, II=National Park, III=Natural Monument, IV=Habitat Management, V=Protected Landscape, VI=Sustainable Use)OWN_TYPE: Ownership type (State, Private, Community, etc.)ISO3: ISO 3166-1 alpha-3 country codeSTATUS_YR: Year of establishment or designationNAME: Protected area nameDESIG_ENG: Designation in English (e.g., National Park, Wildlife Sanctuary)
Overture Maps - Administrative Boundaries
ID:
overture-adminsType: Vector
URL:
pmtiles://https://overturemaps.azureedge.net/release/2024-11-13.0/theme=admins.pmtilesSource Layer:
adminsDescription: Administrative boundary polygons including countries, states/regions, and counties
Attributes:
admin_level: Administrative level (2=country, 4=state/region, 6=county)names: Name information in multiple languagesiso_country_code_alpha_2: ISO country codeiso_sub_country_code: Sub-country codes
Overture Maps - Places
ID:
overture-placesType: Vector
URL:
pmtiles://https://overturemaps.azureedge.net/release/2024-11-13.0/theme=places.pmtilesSource Layer:
placesDescription: Points of interest including businesses, landmarks, and facilities
Attributes:
categories: Category classificationnames: Place names in multiple languagesconfidence: Data confidence score
Natural Earth Countries (50m)
ID:
ne-countriesType: Vector
URL:
pmtiles://https://cdn.protomaps.com/data/ne-50m-countries.pmtilesSource Layer:
countriesDescription: Country boundaries at 1:50m scale from Natural Earth
Attributes:
NAME: Country nameISO_A2: ISO Alpha-2 country codePOP_EST: Population estimateGDP_MD: GDP in millions USDCONTINENT: Continent name
Example Usage Patterns
Create a base map:
{
"tool": "add_layer",
"arguments": {
"id": "osm-base",
"type": "raster",
"source": {
"type": "raster",
"tiles": ["https://tile.openstreetmap.org/{z}/{x}/{y}.png"],
"attribution": "© OpenStreetMap contributors"
}
}
}Add protected areas in a specific country:
{
"tool": "add_layer",
"arguments": {
"id": "wdpa",
"type": "vector",
"source": {
"type": "vector",
"url": "pmtiles://https://s3-west.nrp-nautilus.io/public-wdpa/WDPA_Dec2025.pmtiles"
},
"layers": [{
"id": "wdpa-fill",
"type": "fill",
"source": "wdpa",
"source-layer": "wdpa",
"paint": {"fill-color": "green", "fill-opacity": 0.5}
}]
}
}Filter to specific country (e.g., USA):
{
"tool": "filter_layer",
"arguments": {
"layer_id": "wdpa",
"filter": ["==", ["get", "ISO3"], "USA"]
}
}Style by attribute (e.g., IUCN category):
{
"tool": "set_layer_paint",
"arguments": {
"layer_id": "wdpa",
"property": "fill-color",
"value": [
"match",
["get", "IUCN_CAT"],
"II", "#2ca02c",
"IV", "#1f77b4",
"V", "#ff7f0e",
"#999999"
]
}
}Tips for Layer Selection
Always start with a base layer (OSM, CartoDB, or Esri)
Use light base maps (carto-light) when overlaying lots of data
Use satellite imagery (esri-satellite) for environmental or geographic context
PMTiles sources are efficient for large vector datasets
Filter by geography first (ISO3, admin_level) to improve performance
Use meaningful colors and opacity for multiple overlapping layers
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| state | No | Optional map state JSON string. | |
| filter | Yes | MapLibre filter expression (e.g. ['==', 'property', 'value']) | |
| layer_id | Yes | The ID of the layer to filter. | |
| session_id | No | The session ID. |