# WMTS Capabilities Extractor (`datamule/wmts-capabilities-extractor`) Actor

Point at any OGC Web Map Tile Service (WMTS 1.0.0) and extract a structured tile inventory from GetCapabilities — one row per layer (identifier, formats, styles, WGS84 bbox, TileMatrixSet links, tile-URL template) or per TileMatrixSet (CRS, scale-set, zoom ladder). Any WMTS server.

- **URL**: https://apify.com/datamule/wmts-capabilities-extractor.md
- **Developed by:** [Datamule](https://apify.com/datamule) (community)
- **Categories:** Developer tools, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.35 / 1,000 tile layer / matrix-set rows

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## WMTS Capabilities Extractor

Point at **any** OGC **Web Map Tile Service (WMTS 1.0.0)** endpoint and get a clean, structured inventory of its tiled map layers and tile-matrix sets — one actor, any WMTS server, no per-site scraper.

WMTS is THE OGC standard for pre-rendered, cached map **tiles** (the pyramided-raster sibling of WMS's on-demand maps): global basemaps, national mapping-agency raster series, satellite/aerial imagery mosaics, weather/ocean tile layers and every government Spatial Data Infrastructure publish their tiled maps this way. This actor turns any of them — regardless of the server software behind them — into flat, uniform JSON rows.

It completes the OGC OWS shelf alongside the WMS, WFS, WCS and CSW extractors.

### What it does

Given one or more WMTS sources, it fetches each service's `GetCapabilities` document and emits:

- **`layers` mode (default)** — one row per advertised `<Layer>`: identifier, title, formats, styles (with legend URLs), WGS84 bounding box, native bounding box, the TileMatrixSet links (with any per-link tile-matrix limits), dimensions, metadata URLs and the RESTful `ResourceURL` tile-template.
- **`tilematrixsets` mode** — one row per advertised `<TileMatrixSet>`: identifier, `SupportedCRS`, `WellKnownScaleSet`, the tile-matrix count and the ordered list of tile-matrix (zoom-level) identifiers.
- **`discovery` mode** — the full inventory: every Layer row **and** every TileMatrixSet row from the one document.

Every row carries provenance (`_sourceService`, `_wmtsVersion`, `_serverSoftware`, `_mode`, `_serviceTitle`) plus a lossless `_raw` copy of the source element.

### The cross-vendor grammar is the point

The same normalized row shape comes out regardless of the server software. Verified live against four independent families:

| Source | Server software | Shape quirks handled |
|--------|-----------------|----------------------|
| [EOX::Maps](https://tiles.maps.eox.at/wmts) | MapServer | RESTful `ResourceURL` templates, default XML namespace |
| [USGS National Map](https://basemap.nationalmap.gov) / ArcGIS Online | Esri ArcGIS Server | `ows:WGS84BoundingBox` + native `BoundingBox`, `image/jpgpng`, multiple `TileMatrixSetLink` |
| [DWD GeoServer-GWC](https://maps.dwd.de/geoserver/gwc/service/wmts) | GeoServer / GeoWebCache | colon-in-identifier (`dwd:WORLDMAP`), multiple `Format`/`InfoFormat`, `Style` with `LegendURL` |
| [IGN Spain](https://www.ign.es/wmts/mapa-raster) | national SDI | `TileMatrixSetLimits`, `MetadataURL`, KVP-only tiles (no `ResourceURL`) |

Every element is matched by **local name** (namespace- and prefix-agnostic), so a `wmts:`, `ows:` or default-namespace tree all parse identically.

### Input

- **`sources`** (required) — array of WMTS URLs. Each may be a KVP service base (e.g. `https://tiles.maps.eox.at/wmts` — the `SERVICE=WMTS&REQUEST=GetCapabilities&VERSION=1.0.0` params are appended for you) **or** a direct RESTful capabilities document (e.g. `.../WMTS/1.0.0/WMTSCapabilities.xml` — used as-is, never rewritten).
- **`mode`** — `layers` (default), `tilematrixsets`, or `discovery`.
- **`maxRecords`** — global cap on rows emitted across all sources (default 1000).
- **`userAgent`**, **`bearerToken`**, **`extraHeaders`** — optional; for auth-gated or UA-gated deployments. Never required for public services, never logged.

### Resilience

- A `200` capabilities document with **zero layers** is a real, clean state → 0 rows, exit 0 (never a fabricated layer).
- An `ows:ExceptionReport` (a service error returned with HTTP 200) is a real error → that source is skipped with a warning.
- An unreachable / 4xx-5xx / anti-bot / non-WMTS source is skipped with a warning and the batch continues.
- A run where **every** source is skipped fails fast (non-zero exit) so nothing broken is ever reported as a success.

### Pricing

Pay-per-result: one `layer` event per emitted row.

# Actor input Schema

## `sources` (type: `array`):

One or more OGC Web Map Tile Service (WMTS 1.0.0) endpoints. Each may be either a KVP service base (e.g. https://tiles.maps.eox.at/wmts — the SERVICE=WMTS&REQUEST=GetCapabilities&VERSION=1.0.0 params are appended for you) OR a direct RESTful capabilities document (e.g. https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/WMTS/1.0.0/WMTSCapabilities.xml — used as-is, never rewritten). WMTS is THE OGC standard for pre-rendered map TILES: national basemaps, satellite/aerial mosaics, weather/ocean tile layers and every government SDI. Each emitted row is tagged with its source (_sourceService). A source that is unreachable, behind an anti-bot wall, returns an error page or is not a WMTS is skipped with a warning; the batch continues.
## `mode` (type: `string`):

What to extract from each capabilities document. 'layers' (default) — one row per advertised tile Layer with its identifier, formats, styles, WGS84 bounding box, TileMatrixSet links and the RESTful ResourceURL tile template. 'tilematrixsets' — one row per advertised TileMatrixSet with its identifier, SupportedCRS, WellKnownScaleSet and the ordered tile-matrix (zoom-level) id ladder. 'discovery' — the full inventory: every Layer row AND every TileMatrixSet row (the _mode field tells them apart).
## `maxRecords` (type: `integer`):

A GLOBAL cap on the number of rows to emit across ALL sources (each row is one billable event). Parsing stops as soon as the cap is reached, so a small value is a cheap deterministic sample. Leave empty for the default (1000).
## `userAgent` (type: `string`):

Optional override for the HTTP User-Agent header. Leave empty to send a browser-like default (some government WMTS hosts 403 a bare/anonymous User-Agent).
## `bearerToken` (type: `string`):

Optional bearer token for an auth-gated WMTS deployment (sent as Authorization: Bearer ***). NOT required for public services. Never logged.
## `extraHeaders` (type: `object`):

Optional extra HTTP headers as a JSON object, e.g. {"X-Api-Key": "..."} for a gateway-fronted instance. Not required for public servers. Header values are never logged.

## Actor input object example

```json
{
  "sources": [
    "https://tiles.maps.eox.at/wmts?SERVICE=WMTS&REQUEST=GetCapabilities"
  ],
  "mode": "layers",
  "maxRecords": 1000
}
````

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "sources": [
        "https://tiles.maps.eox.at/wmts?SERVICE=WMTS&REQUEST=GetCapabilities"
    ],
    "maxRecords": 1000
};

// Run the Actor and wait for it to finish
const run = await client.actor("datamule/wmts-capabilities-extractor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "sources": ["https://tiles.maps.eox.at/wmts?SERVICE=WMTS&REQUEST=GetCapabilities"],
    "maxRecords": 1000,
}

# Run the Actor and wait for it to finish
run = client.actor("datamule/wmts-capabilities-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "sources": [
    "https://tiles.maps.eox.at/wmts?SERVICE=WMTS&REQUEST=GetCapabilities"
  ],
  "maxRecords": 1000
}' |
apify call datamule/wmts-capabilities-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=datamule/wmts-capabilities-extractor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "WMTS Capabilities Extractor",
        "description": "Point at any OGC Web Map Tile Service (WMTS 1.0.0) and extract a structured tile inventory from GetCapabilities — one row per layer (identifier, formats, styles, WGS84 bbox, TileMatrixSet links, tile-URL template) or per TileMatrixSet (CRS, scale-set, zoom ladder). Any WMTS server.",
        "version": "0.1",
        "x-build-id": "s95XOrtrMgwnqYMfC"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/datamule~wmts-capabilities-extractor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-datamule-wmts-capabilities-extractor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/datamule~wmts-capabilities-extractor/runs": {
            "post": {
                "operationId": "runs-sync-datamule-wmts-capabilities-extractor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/datamule~wmts-capabilities-extractor/run-sync": {
            "post": {
                "operationId": "run-sync-datamule-wmts-capabilities-extractor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "sources"
                ],
                "properties": {
                    "sources": {
                        "title": "WMTS source URL(s)",
                        "type": "array",
                        "description": "One or more OGC Web Map Tile Service (WMTS 1.0.0) endpoints. Each may be either a KVP service base (e.g. https://tiles.maps.eox.at/wmts — the SERVICE=WMTS&REQUEST=GetCapabilities&VERSION=1.0.0 params are appended for you) OR a direct RESTful capabilities document (e.g. https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/WMTS/1.0.0/WMTSCapabilities.xml — used as-is, never rewritten). WMTS is THE OGC standard for pre-rendered map TILES: national basemaps, satellite/aerial mosaics, weather/ocean tile layers and every government SDI. Each emitted row is tagged with its source (_sourceService). A source that is unreachable, behind an anti-bot wall, returns an error page or is not a WMTS is skipped with a warning; the batch continues.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "layers",
                            "tilematrixsets",
                            "discovery"
                        ],
                        "type": "string",
                        "description": "What to extract from each capabilities document. 'layers' (default) — one row per advertised tile Layer with its identifier, formats, styles, WGS84 bounding box, TileMatrixSet links and the RESTful ResourceURL tile template. 'tilematrixsets' — one row per advertised TileMatrixSet with its identifier, SupportedCRS, WellKnownScaleSet and the ordered tile-matrix (zoom-level) id ladder. 'discovery' — the full inventory: every Layer row AND every TileMatrixSet row (the _mode field tells them apart).",
                        "default": "layers"
                    },
                    "maxRecords": {
                        "title": "Max records (global cap)",
                        "minimum": 1,
                        "type": "integer",
                        "description": "A GLOBAL cap on the number of rows to emit across ALL sources (each row is one billable event). Parsing stops as soon as the cap is reached, so a small value is a cheap deterministic sample. Leave empty for the default (1000)."
                    },
                    "userAgent": {
                        "title": "User-Agent override",
                        "type": "string",
                        "description": "Optional override for the HTTP User-Agent header. Leave empty to send a browser-like default (some government WMTS hosts 403 a bare/anonymous User-Agent)."
                    },
                    "bearerToken": {
                        "title": "Bearer token",
                        "type": "string",
                        "description": "Optional bearer token for an auth-gated WMTS deployment (sent as Authorization: Bearer ***). NOT required for public services. Never logged."
                    },
                    "extraHeaders": {
                        "title": "Extra request headers",
                        "type": "object",
                        "description": "Optional extra HTTP headers as a JSON object, e.g. {\"X-Api-Key\": \"...\"} for a gateway-fronted instance. Not required for public servers. Header values are never logged."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
