From OpenStreetMap Wiki
Jump to navigation Jump to search

Terms of use

OpenRailwayMap is a non-commercial project, financed by donations and run by volunteers. Our infrastructure has a limited capacity, therefore we allow using the API and the tiles under the following conditions:

  • Small scale applications with few or relatively small requests are allowed to use the API and tiles free and without charge.
  • Generally there is no differentiation between commercial and non-commercial applications; however, financial support is highly appreciated.
  • Applications have to send an unique User-Agent (name and website URL) with their requests in order to be able to contact the maintainers them if there are any problems. If tiles are embedded into a website, it is technically not possible to send a User-Agent. In this use cases it is not necessary to send a User-Agent due to the fact that the browser automatically sends a referer while loading the images. This referer string is sufficient as an identification.
  • Users sending large scale API queries or tile requests will be blocked and - if identifiable - contacted.
  • If your application was blocked, we either give you tips on how the required functionality can be set up on your own server, or would allow a further use of our services in exchange for financial support.
  • Most API requests should normally take no longer than 3 seconds. In any case, you should write your application so that it will time out requests after ca. 5 seconds. If multiple requests fail in a row, your application should assume that the service is not available and slow down the rate of attempts.
  • The API limits the rate of requests to a sensible level. The limits are designed to protect the API from too heavy load, and to protect the database contents from harvesting. If your application hits the limits and you'd like to have a larger quota, please get in touch and describe your application's needs in detail.
  • The application may only request data or tiles when it is actively needed by the end-user. If you want to perform bulk requests, add some delays to let your bulk request behave like a human users. And generally try to use as much caching as possible to reduce the load.
  • The availability is generally very good, but there are no guarantees. Remind that this is a free service offered by a non-commercial community project. If you need a full reliable service, you should set up your own instance of this API or tile server.

The OpenRailwayMap data, which comes from from the OpenStreetMap database, is available under the Open Data Commons Open Database License (ODbL). The OpenRailwayMap tiles are available under Creative-Commons license Attribution-ShareAlike 2.0 (CC-BY-SA 2.0).

Using the OpenRailwayMap tiles requires this attribution:

Data <a href="">© OpenStreetMap contributors</a>, Style: <a href="">CC-BY-SA 2.0</a> <a href="">OpenRailwayMap</a>

Using also standard OpenStreetMap tiles as a background map, which is the case if you are including the OpenRailwayMap slippy map into your website, requires this attribution:

Data <a href="">© OpenStreetMap contributors</a>, Style: <a href="">CC-BY-SA 2.0</a> <a href="">OpenRailwayMap</a> and OpenStreetMap

If data is requested by using our API, the following attribution is required:

Data <a href="">© OpenStreetMap contributors</a>, Service by <a href="">OpenRailwayMap</a>

Attributions with text colour equal to the background colour, very small font sizes, full or partly hidden text and disabled links do not count.


The map tiles follow the standard Web Mercator tile format - also known as Spherical Mercator, OpenStreetMap or Google tiles. They are usually supported natively by any map library that you are using, but read on if you want to know more details.

The bitmap tiles have a size of 512 x 512 pixels and are in PNG format. The usable resolution is 256 x 256 pixels because the tiles are rendered in "retina" resolution. The projection is Spherical Mercator - known by the projection codes EPSG:3857, EPSG:900913 and EPSG:3785. They can be accessed under this URL:


Modern browsers restrict the number of simultaneous image request to one domain by default. To work around this limitation and load tiles faster, we can make simultaneous requests to multiple domains which point to the same server. Replacing the placeholder ${s} by a, b or c creates different subdomains. The subdomain is optional and can be omitted if it is not needed.

The placeholder ${style} has to be replaced by the name of a rendering style. Currently there are the following styles:

Value Description
standard Default railway layer visualizing infrastructure such as tracks, stations, line numbers, switches, etc.
signals Visualization of railway signals and train protection systems
maxspeed Visualization of railway line maxspeeds and speed signals

Usage in OpenLayers 2

var openrailwaymap = new OpenLayers.Layer.XYZ("OpenRailwayMap", ["${z}/${x}/${y}.png","${z}/${x}/${y}.png","${z}/${x}/${y}.png"],
	sphericalMercator: true,
	opacity: 1,
	visibility: false,
	transparent: true,
	noOpaq: true,
	isBaseLayer: false,
	attribution: '<a href="">© OpenStreetMap contributors</a>, Style: <a href="">CC-BY-SA 2.0</a> <a href="">OpenRailwayMap</a> and OpenStreetMap'

Usage in OpenLayers 3

var openrailwaymap = new ol.layer.Tile({
    title: 'OpenRailwayMap',
    visible: true,
    source : new ol.source.XYZ({
                attributions : [
                    new ol.Attribution({
                        html : 'Style: <a href="">CC-BY-SA 2.0</a> <a href="">OpenRailwayMap</a> and OpenStreetMap'
                url : 'http://{a-c}{z}/{x}/{y}.png',
                crossOrigin: null, //make it work inside canvas
                tilePixelRatio: 2, //server returns 512px img for 256 tiles
                maxZoom: 19, // XYZ's default is 18
                opaque: true

Usage in Leaflet

var openrailwaymap = new L.TileLayer('http://{s}{z}/{x}/{y}.png',
	attribution: '<a href="">© OpenStreetMap contributors</a>, Style: <a href="">CC-BY-SA 2.0</a> <a href="">OpenRailwayMap</a> and OpenStreetMap',
	minZoom: 2,
	maxZoom: 19,
	tileSize: 256

Usage in OsmAnd

A layer of maxspeeds (downloaded live from the OpenRailwayMap database), based on a pre-installed offline map in OsmAnd 2.0

It only takes a few easy steps to display online OpenRailwayMap tiles on top of a offline OsmAnd map.

The following steps refer to the Android app. iOS users please note the hints by Krist van Besien at OsmAnd Google Group.

In order to perform the following steps, the "Online maps" plugin needs to be enabled. The list of plugins can be accessed via the square symbol in the lower left corner of the main menu (you might have to scroll down a bit and enable "Show all" in the "Plugins" section.

  1. With the Online maps plugin enabled, select the layer symbol in the upper left corner of the main menu.
  2. In the "Configure map" dialog, scroll down to "Overlay map..." or "Underlay map..."
  3. Choose "Install more...", scroll down and you will select the OpenRailwayMap layers desired (OpenRailwayMap, OpenRailwayMap maxspeed, OpenRailwayMap signalling).

Now, you can choose those layers in the overlay/underlay menus.

Hint: With default settings, overlay maps might appear a bit pale. Map transparency can be altered in two days:

  • There is a small scroll bar in the lower mid section of the main screen.
  • You can access the settings menu of the Online map plugin via the square symbol in the lower left corner. Press "Online maps", then choose "Settings", scroll down and select "Overlay transparency" or "Base map transparency".

A full offline usability of OpenRailwayMap in OsmAnd isn't possible yet. The project has not enough resources to offer ready-to-use offline data for downloading. It is possible to generate offline maps yourself, but the necessary stylesheet for OsmAnd has not been written yet. Further details can be found in the OpenRailwayMap repository.

Usage in QGIS

Add OpenRailwayMap as an XYZ tiles layer in QGIS using the following URL:{z}/{x}/{y}.png

Usage in legacy QGIS

It is possible to use OpenRailwayMap tile overlays in QGIS using the Tile Map Scale Levels plugin and the following XML configuration. The placeholder ${style} has to be replaced by the name of a rendering style. Have a look at the table above for the available style names.

	<Service name="TMS">


The OpenRailwayMap provides a RESTful HTTP API which makes it easy to request railway data in OpenStreetMap. Requests are received via GET, the results are returned as JSON data.

The API supports Cross-Origin Resource Sharing (CORS), by sending Access-Control-Allow-Origin: * in the header for each response.

URL parameters and iframes