Topics:

Background map

Background map provides HSL style map tiles for example for browser based applications.

Data format

Raster maps are available in Tile Map Service format

Note: Background map is also available as vector tiles from source hsl-vector-map.

Endpoint

https://cdn.digitransit.fi/map/v1/:source/:z/:x/:y:size.png

Supported URL parameters

Parameter Type Description
source string
  • hsl-map for 512px raster tiles
  • hsl-map-256 for 256px raster tiles
  • hsl-map-sv for 512px raster tiles with Swedish language
  • hsl-map-sv-256 for 256px raster tiles with Swedish language
  • hsl-vector-map for vector tiles
z int Zoom level
x int x-coordinate
y int y-coordinate
size string '@2x' for retina tiles or empty value for normal

Examples

An example of what the HSL map tiles look like

hsl-map-style

HSL style map tiles

https://cdn.digitransit.fi/map/v1/hsl-map/16/37313/18958.png

Retina tiles

https://cdn.digitransit.fi/map/v1/hsl-map/16/37313/18958@2x.png

Swedish language tiles

https://cdn.digitransit.fi/map/v1/hsl-map-sv/16/37313/18958.png

Test the API

Display map using Leaflet

Here is a quick example that uses Leaflet to display scrollable map.
Note that this example is using hsl-map tiles (512px), which are not the size that Leaflet expects. To display 512px tiles correctly with Leaflet, use options tileSize: 512 and zoomOffset: -1