Skip to content

Use tile services in JavaScript clients

Koordinates tile services are available as an XYZ tile service for Javascript clients, such as Leaflet and OpenLayers.

This service is compatible with the Google Map API and can be easily combined with other global map tile services such as Open Street Map (OSM) or Microsoft Bing Maps.

Koordinates web map tile services use HTTPS.

To access Koordinates XYZ tile services, you can use the following base URL in your application:

https://tiles-cdn.koordinates.com/services;key=YOUR_API_KEY/tiles/v4/layer=LAYER_ID/EPSG:3857/{z}/{x}/{y}.png

or, with a custom style:

https://tiles-cdn.koordinates.com/services;key=YOUR_API_KEY/tiles/v4/layer=LAYER_ID,style={styleID}/EPSG:3857/{z}/{x}/{y}.png

You can also cut and paste this URL from the Services and APIs tab on your chosen layer. About this URL:

  • YOUR_API_KEY — your Koordinates API key
  • LAYER_ID — the identifier of the web map tiled layer. You’ll find this identifer after /layer in the layer’s URL
  • STYLE_ID - the ID of the custom WMTS you want to display for the layer
  • CRS – identifier of the coordinate reference system of the tile grid you are requesting. By default, Koordinates tile service URLs are provided as EPSG:3857 (WGS84 Web Mercator).
  • Write the coordinate system with a plain colon, as in EPSG:3857. Some clients encode characters in the URL path by default, which turns the colon into %3A. If your tiles don’t load, check the request URL your client sends and switch off that encoding for the coordinate system.
  • Z, X, Y – z is zoom level, x tile column and y tile row. Your client will substitute values here for you.

Please note: tile services accept your API key in the URL path, as ;key=YOUR_API_KEY in the examples above, or in an Authorization: key YOUR_API_KEY request header. They do not accept the key as a query-string parameter: a tile URL ending in ?key=YOUR_API_KEY is rejected with a 401 error, even though the Query API does accept ?key=. Use the path form for clients that can’t set headers, such as Leaflet or OpenLayers tile layers. Your key needs the tiles scope. Because the key appears in the URL, make it a read-only key with just the scopes you need: see API key scopes.

Please note: Some map tile services are created from a collection of several data layers. In these cases, layer=LAYER_ID is replaced by set=SET_ID in the URL:

https://tiles-cdn.koordinates.com/services;key=YOUR_API_KEY/tiles/v4/set=SET_ID/EPSG:3857/{z}/{x}/{y}.png

Adding Koordinates XYZ services to Leaflet

Section titled “Adding Koordinates XYZ services to Leaflet”

Adding Koordinates XYZ Services to a Leaflet map is simple, using the Leaflet tileLayer interface:

let layer = L.tileLayer('https://tiles-cdn.koordinates.com/services;key=YOUR_API_KEY/tiles/v4/layer=LAYER_ID/EPSG:3857/{z}/{x}/{y}.png');
layer.addTo(map);

Adding Koordinates XYZ services to OpenLayers

Section titled “Adding Koordinates XYZ services to OpenLayers”

Adding Koordinates XYZ Services to an OpenLayers map can be achieved with the TileLayer class:

let layer = new TileLayer({
source: new XYZ({
url: 'https://tiles-cdn.koordinates.com/services;key=YOUR_API_KEY/tiles/v4/layer=LAYER_ID/EPSG:3857/{z}/{x}/{y}.png'
}),
});
map.addLayer(layer);

You may wish to overlay vector data into your web map client to highlight points of interest, specific attributes or selected features. The best way to do this is use Koordinates Vector Query API. Read the documentation for the Vector Query API.

Please note that if you are integrating tile services into a public map service, you will need to take steps to protect your API key from being exposed to anonymous users.

Koordinates also supports OGC-compliant Web Map Tile Service (version 1.0.0) style requests.

Koordinates tile services support RESTful requests. GetFeatureInfo requests can also use the KVP interface. The SOAP request interface is not supported.

Koordinates tile services support the HTTP GET method only for retrieving tiles. The following requests are supported:

  • GetCapabilities: returns metadata about the service
  • GetTile: returns an individual map tile from the cache
  • GetFeatureInfo: returns descriptive information for a given map location

If you prefer, you can use our OGC WMTS tile services and configure URL requests to retrieve tiles. In this method, your web client will use the GetCapabilities request to determine the tilematrix definition. This means one more request for your client, but it reduces the configuration client side.

https://koordinates.com/services;key=YOUR_API_KEY/wmts/1.0.0/layer/LAYER_ID/WMTSCapabilities.xml

Some of the URL components are similar to the XYZ example above:

  • YOUR_API_KEY — your Koordinates API key
  • LAYER_ID — the identifier of the web map tiled layer. You’ll find this identifer after /layer in the layer’s URL

Please note: WMTS URLs take the API key in the URL path (;key=YOUR_API_KEY) or in an Authorization: key YOUR_API_KEY header. A ?key=YOUR_API_KEY query-string parameter is rejected with a 401 error.

Please note: Some map tile services are created from a collection of several data layers. In these cases, layer/LAYER_ID is replaced by set/SET_ID in the URL.

https://koordinates.com/services;key=YOUR_API_KEY/wmts/1.0.0/set/SET_ID/WMTSCapabilities.xml