Skip to main content
Open Mobile Maps supports the WMTS (Web Map Tile Service) standard and can parse Capability XML files to automatically generate raster layer configurations.

Parsing WMTS Capabilities

Create a WMTS resource from a Capabilities XML document.
val resource = WmtsCapabilitiesResource.create(xml)

Creating Layers from WMTS

Once you have a WMTS capabilities resource, create layers using specific layer identifiers.
val resource = WmtsCapabilitiesResource.create(xml)
val layer = resource.createLayer("identifier", dataLoader)
mapView.addLayer(layer.asLayerInterface())

With Custom Data Loader

val dataLoader = DataLoader(this, cacheDir, 50L * 1024L * 1024L, "example-referrer")
val resource = WmtsCapabilitiesResource.create(xml)
val layer = resource.createLayer("identifier", dataLoader)
mapView.addLayer(layer.asLayerInterface())

Parameters

xml
String
required
The WMTS GetCapabilities XML response as a string
identifier
String
required
The layer identifier from the WMTS capabilities document
dataLoader
DataLoader
required
Data loader for fetching tiles (Android)
tileLoader
TextureLoader
required
Texture loader for fetching tiles (iOS)

WMTS Capabilities XML

A WMTS GetCapabilities response typically looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<Capabilities xmlns="http://www.opengis.net/wmts/1.0"
              xmlns:ows="http://www.opengis.net/ows/1.1"
              xmlns:xlink="http://www.w3.org/1999/xlink"
              version="1.0.0">
  <ows:ServiceIdentification>
    <ows:Title>Example WMTS Service</ows:Title>
  </ows:ServiceIdentification>
  <Contents>
    <Layer>
      <ows:Title>Base Map</ows:Title>
      <ows:Identifier>basemap</ows:Identifier>
      <Style isDefault="true">
        <ows:Identifier>default</ows:Identifier>
      </Style>
      <Format>image/png</Format>
      <TileMatrixSetLink>
        <TileMatrixSet>EPSG:3857</TileMatrixSet>
      </TileMatrixSetLink>
    </Layer>
    <!-- Additional layers -->
  </Contents>
</Capabilities>

Fetching WMTS Capabilities

You can fetch the capabilities XML from a WMTS service endpoint:
https://example.com/wmts?SERVICE=WMTS&REQUEST=GetCapabilities

Texture/Data Loaders

The Android implementation uses DataLoader which can be configured with caching:
val dataLoader = DataLoader(
    context = this,
    cacheDir = cacheDir,
    cacheSize = 50L * 1024L * 1024L, // 50 MB
    referrer = "com.example.app"
)

Example: Complete WMTS Integration

// Fetch capabilities XML (pseudo-code)
val xml = fetchCapabilitiesXML("https://example.com/wmts?SERVICE=WMTS&REQUEST=GetCapabilities")

// Parse capabilities
val resource = WmtsCapabilitiesResource.create(xml)

// Create data loader
val dataLoader = DataLoader(this, cacheDir, 50L * 1024L * 1024L, "my-app")

// Create layer with specific identifier
val layer = resource.createLayer("basemap", dataLoader)

// Add to map
mapView.addLayer(layer.asLayerInterface())
This feature is still being improved to support a wider range of WMTS capabilities. Some WMTS services may not be fully supported.

Supported Features

  • Parsing WMTS 1.0.0 GetCapabilities responses
  • Layer creation from capability identifiers
  • Automatic tile matrix configuration
  • Multiple coordinate reference systems
  • Custom data/texture loaders

Limitations

  • Not all WMTS capability variations are currently supported
  • Complex tile matrix sets may require additional configuration
  • Some advanced WMTS features may need custom implementation

Build docs developers (and LLMs) love