---
title: "OGC API — Tiles in MapTiler Server | Guides | Self hosting | Map server"
description: "Learn how to use OGC API Tiles with MapTiler Server."
---

> 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.

# OGC API — Tiles in MapTiler Server

The OGC API — Tiles standard defines endpoints for creating Web APIs that support retrieving geospatial information as tiles. It is a successor to the WMTS standard.

MapTiler Server supports the following JSON endpoints:

-   **Dataset landing page** defines a dataset and provides access to the tiles.
    
    -   [Tileset](https://docs.maptiler.com/cloud/api/tiles/#tag/tiles/GET/tiles/{tilesId}/tiles): `https://<YOUR_HOST>/api/tiles/{tilesId}/tiles`
    -   [Rasterized map](https://docs.maptiler.com/cloud/api/maps/#tag/maps/GET/maps/{mapId}/tiles): `https://<YOUR_HOST>/api/maps/{mapId}/tiles`
-   **Dataset TileMatrixSets** describes the dataset tile matrix sets according to the OGC Web API.
    
    -   [Tileset](https://docs.maptiler.com/cloud/api/tiles/#tag/tiles/GET/tiles/{tilesId}/tileMatrixSet): `https://<YOUR_HOST>/api/tiles/{tilesId}/tileMatrixSet`
    -   [Rasterized map](https://docs.maptiler.com/cloud/api/maps/#tag/maps/GET/maps/{mapId}/tileMatrixSet): `https://<YOUR_HOST>/api/maps/{mapId}/tileMatrixSet`
-   **Conformance Classes** declares the [conformance classes](https://docs.maptiler.com/cloud/api/other/#tag/other/GET/ogc/conformance) implemented within our API.
    
    -   `https://<YOUR_HOST>/api/ogc/conformance`

The **Dataset landing page** can be used in software supporting the OGC API — Tiles specification (currently OpenLayers).

## Getting started with OpenLayers

We’ve prepared an [OpenLayers demo viewer](https://labs.maptiler.com/openlayers-ogcapi/) for raster and vector tiles to showcase the capabilities. Implementing this in your web applications is straightforward, see the OpenLayers [OGC Vector Tiles](https://openlayers.org/en/latest/examples/ogc-vector-tiles.html) and [OGC Raster Tiles](https://openlayers.org/en/latest/examples/ogc-map-tiles.html) examples.

1.  Load the OpenLayers library in the `<head>` section and set the UTF-8 encoding.
    
    ```html
    <meta charset="UTF-8">
     <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v10.1.0/ol.css">
     <script src="https://cdn.jsdelivr.net/npm/ol@v10.1.0/dist/ol.js"></script>
    ```
    
2.  Add an element to be inflated by the OpenLayers into the HTML `<body>`.
    
    ```html
    <div id="map" style="width: 640px; height: 480px;"></div>
    ```
    
3.  Get the URL of the dataset:
    1.  Go to your MapTiler Server at `http://localhost:3650/admin`.
    2.  To get a URL of a rasterized map, click **Details** next to the map. For a tileset, go to page **Tiles** and click **Details** next to the desired tileset.
    3.  Find the **OGC Tiles API** section and copy the URL.
4.  Add JavaScript code that will initialize the OpenLayers raster map.
    
    ```js
    new ol.Map({
      target: 'map',
      layers: [
     new ol.layer.Tile({
       source: new ol.source.OGCMapTile({
         url: 'https://<YOUR_HOST>/api/maps/{mapId}/tiles',
       }),
     }),
      ],
      view: new ol.View({
     center: [0, 0],
     zoom: 1,
      }),
    });
    ```
    
    -   Check that the `target` matches the `id` of the inflated HTML element.
    -   In the `layers` array, there’s a raster layer `Tile` with the `OGCMapTile` source. Point its `url` to your map’s dataset.
    -   Set the desired initial zoom level and map position in the `view` property.
5.  To load a vector tileset, replace `Tile` with `VectorTile` and add some basic styling.
    
    ```js
    new ol.layer.VectorTile({
      source: new ol.source.OGCVectorTile({
     url: 'https://<YOUR_HOST>/api/tiles/{tilesId}/tiles',
     format: new ol.format.MVT(),
      }),
      background: '#85CBFA',
      style: {
     'fill-color': '#FCF7E4',
      },
    })
    ```
    
6.  Add a proper [attribution](https://docs.maptiler.com/guides/map-design/attribution/add-attribution/).

### Custom projections with OpenLayers

OpenLayers library includes [definitions](https://openlayers.org/en/latest/apidoc/module-ol_proj_Projection-Projection.html) for `EPSG:4326` and `EPSG:3857`. Use `proj4` to define any other projection. Here is an example for `EPSG:5514`:

1.  Load `proj4` library in the `<head>` section.
    
    ```js
    <script src="https://cdn.maptiler.com/proj4js/v2.5.0/proj4.js"></script>
    ```
    
2.  Define the projection before `ol.Map` initialization:
    
    ```js
    const projName = "http://www.opengis.net/def/crs/EPSG/0/5514";
      const projDef = "+proj=krovak +lat_0=49.5 +lon_0=24.8333333333333 +alpha=30.2881397527778 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel +towgs84=589,76,480,0,0,0,0 +units=m +no_defs +type=crs"
      ol.proj.proj4.register(proj4);
      proj4.defs(projName, projDef);
    ```
    
    1.  The projection name (`projName`) is the `crs` URL:
        
        Look into the console for an error like this: `Error: Unsupported CRS: http://www.opengis.net/def/crs/EPSG/0/5514`
        
        Alternatively, look into the dataset definition for the `crs` property.
        
    2.  The projection definition (`projDef`) can be obtained:
        
        Manually from [epsg.io](https://epsg.io/5514.proj4), e.g. from [https://epsg.io/5514.proj4](https://epsg.io/5514.proj4).
        
        Dynamically using the [fromEPSGCode](https://openlayers.org/en/latest/apidoc/module-ol_proj_proj4.html#.fromEPSGCode) method, e.g. `ol.proj.proj4.fromEPSGCode("EPSG:5514")` (not recommended).
        
3.  Set the projection of the Non-Mercator OGCMapTile or OGCVectorTile source.
    
    ```js
    new ol.layer.Tile({
      source: new ol.source.OGCMapTile({
     projection: projName,
     url: 'https://<YOUR_HOST>/api/tiles/{tilesId}/tiles',
      }),
    }),
    ```
    

### OpenLayers limitations

-   OpenLayers doesn’t automatically read or set `tileGrid` from the tileset tile matrix sets description.
-   The view is not initialized from the OGC API — Tiles `centerPoint` property.

## Getting started with QGIS

To use raster tiles in QGIS, you’ll need to create two more JSON files (endpoints). In this example, we will add a satellite map into QGIS.

1.  Create a new local JSON file, e.g. `tilesets.json`. This endpoint declares a list of the tileset projections.
    
    ```js
    {
      "tilesets": [
     {
       "dataType": "map",
       "crs": "http://www.opengis.net/def/crs/EPSG/0/3857",
       "links": [
         {
           "rel": "self",
           "type": "application/json",
           "href": "https://<YOUR_HOST>/api/maps/{mapId}/tiles"
         }
       ]
     }
      ]
    }
    ```
    
    Set the API URL to the desired tileset/map.
    
2.  Create another file within the same folder, e.g. `landing.json`. This endpoint is a dataset landing page linking the previous endpoint. This file will be always the same.
    
    ```js
    {
      "links": [
     {
       "rel": "http://www.opengis.net/def/rel/ogc/1.0/tilesets-map",
       "type": "application/json",
       "href": "/tilesets.json"
     }
      ],
      "extent": {
     "spatial": {
       "bbox": [[-180, -85.0511, 180, 85.0511]]
     }
      }
    }
    ```
    
3.  OGC API — Tiles is used to request tiled data from a web service, not directly load a static local file. You have to:
    
    1.  Upload the JSON files on some web server. Ensure that `href` link from `landing.json` to `tilesets.json` is correct.
    2.  Start a local server to serve the JSON files. In Python:
        
        1.  Open the terminal and go to the folder containing the JSON files.
        2.  Run: `python3 -m http.server`
        3.  The URL will be: `http://localhost:8000/landing.json`
4.  Load the dataset landing page endpoint in QGIS.
    
    1.  Go to menu **Layer** > **Add Layer** > **Add Raster Layer** (Ctrl+Shift+R).
    2.  As the **Source Type**, select `OGC API`.
    3.  As **Source**, enter the `landing.json` URL.

### QGIS limitations

-   OGC API — Tiles standard works only with Windows and QGIS 3.38 (GDAL 3.9).
-   Only raster tiles are supported.
-   QGIS doesn’t support reading tiles directly from the dataset landing page. QGIS can only work with raster tilesets and raster collections.

It’s important to note that GDAL/QGIS implements the draft of the OGC API — Tiles standard and the implementation is likely to change.

Supporting QGIS is on our roadmap, and we plan to expand the compatibility.
