Terrain tiles API

The GPXZ API now has terrain tiles!

There’s a TileJSON endpoint

https://api.gpxz.io/v1/elevation/tiles.json?api_key=replace_with_your_gpxz_api_key

and an XYZ / slippymap endpoint

https://api.gpxz.io/v1/elevation/tile/{z}/{x}/{y}.png?api_key=replace_with_your_gpxz_api_key

both with support for png and webp images, mapbox and terrarium DEM encoding, and various tile size options to accomodate high-dpi retina screens.

hillshading

Application

XYZ tiles (and TileJSON) are a standard format for defining terrain map tiles. They’re supported by most geospatial mapping software, and make it easy to migrate from other tile providers such as Mapterhorn, Mapbox or Mapzen.

You can add them to GIS software like QGIS for analysis:

QGIS config for GPXZ terrain tiles

Or use GPXZ data in a webmap with MapLibre

<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel='stylesheet' href='https://unpkg.com/[email protected]/dist/maplibre-gl.css' />
    <script src='https://unpkg.com/[email protected]/dist/maplibre-gl.js'></script>
    <style>
        body {
            margin: 0;
            padding: 0;
        }
        html, body, #map {
            height: 100%;
        }
    </style>
</head>

<body>
    <div id='map'></div>
    <script>
        const map = new maplibregl.Map({
            container: 'map',
            zoom: 10,
            center: [11.491, 47.274],
            pitch: 0,
            hash: true,
            style: {
                version: 8,
                sources: {
                    hillshadeSource: {
                        type: 'raster-dem',
                        tiles: ['https://api.gpxz.io/v1/elevation/tile/{z}/{x}/{y}@2x.png?api_key=replace_with_your_gpxz_api_key'],
                        encoding: 'terrarium',
                        tileSize: 512,
                        maxzoom: 18
                    },
                },
                layers: [
                    {
                        id: 'hillshade',
                        type: 'hillshade',
                        source: 'hillshadeSource',
                        paint: {
                            'hillshade-method': 'standard',
                            'hillshade-illumination-direction': 315,
                            'hillshade-shadow-color': '#000000',
                            'hillshade-highlight-color': '#FFFFFF',
                            'hillshade-accent-color': '#000000',
                            'hillshade-exaggeration': 0.5
                        }
                    },

                ]
            },
            maxZoom: 18,
            maxPitch: 85
        });
    </script>
</body>
</html>

MapLibre fullscreen in-browser webmap

Access

Terrain tile access is included in all plans, including the free plan. There’s a different (higher) quota compared to regular API requests.

You’ll need to use an API key with the tiles scope. We recommend creating a new tightly-scoepd API key for each tiles project, and using some of the other methods we have to secure API keys by restricting their use to a certain domain.

Check out the tile API documentation for full details, or reach out to [email protected] with any questions. Happy mapping!