Pl:OpenRailwayMap/API

From OpenStreetMap Wiki
Jump to: navigation, search
Dostępne języki — OpenRailwayMap/API
· Afrikaans · Alemannisch · aragonés · asturianu · Aymar aru · azərbaycanca · Bahasa Indonesia · Bahasa Melayu · bamanankan · Bân-lâm-gú · Basa Jawa · Basa Sunda · Baso Minangkabau · bosanski · brezhoneg · català · čeština · corsu · dansk · Deutsch · eesti · English · español · Esperanto · estremeñu · euskara · français · Frysk · Gaeilge · Gàidhlig · galego · Hausa · hrvatski · Igbo · interlingua · Interlingue · isiXhosa · isiZulu · íslenska · italiano · Kiswahili · Kreyòl ayisyen · kréyòl gwadloupéyen · kurdî · Latina · latviešu · Lëtzebuergesch · lietuvių · Limburgs · magyar · Malagasy · Malti · Nederlands · Nedersaksies · norsk · norsk nynorsk · occitan · Oromoo · oʻzbekcha/ўзбекча · Plattdüütsch · polski · português · română · shqip · slovenčina · slovenščina · Soomaaliga · suomi · svenska · Tagalog · Tiếng Việt · Türkçe · Türkmençe · Vahcuengh · vèneto · walon · Wolof · Yorùbá · Zazaki · isiZulu · српски / srpski · авар · Аҧсшәа · башҡортса · беларуская · български · қазақша · Кыргызча · македонски · монгол · русский · тоҷикӣ · українська · Ελληνικά · Հայերեն · ქართული · नेपाली · भोजपुरी · मराठी · संस्कृतम् · हिन्दी · অসমীয়া · বাংলা · ਪੰਜਾਬੀ · ગુજરાતી · ଓଡ଼ିଆ · தமிழ் · తెలుగు · ಕನ್ನಡ · മലയാളം · සිංහල · བོད་ཡིག · ไทย · မြန်မာဘာသာ · ລາວ · ភាសាខ្មែរ · ⵜⴰⵎⴰⵣⵉⵖⵜ · አማርኛ · 한국어 · 日本語 · 中文(简体)‎ · 中文(繁體)‎ · 吴语 · 粵語 · ייִדיש · עברית · اردو · العربية · پښتو · سنڌي · فارسی · ދިވެހިބަސް

Warunki korzystania

OpenRailwayMap to projekt niekomercyjny, finansowany z darowizn i prowadzony przez wolontariuszy. Nasza infrastruktura ma ograniczoną pojemność, dlatego zezwalamy na używanie interfejsu API i kafli na następujących warunkach:

  • 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.
  • 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 took 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="http://www.openstreetmap.org/copyright">© OpenStreetMap contributors</a>, Style: <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA 2.0</a> <a href="http://www.openrailwaymap.org/">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="http://www.openstreetmap.org/copyright">© OpenStreetMap contributors</a>, Style: <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA 2.0</a> <a href="http://www.openrailwaymap.org/">OpenRailwayMap</a> and OpenStreetMap

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

Data <a href="http://www.openstreetmap.org/copyright">© OpenStreetMap contributors</a>, Service by <a href="http://www.openrailwaymap.org/">OpenRailwayMap</a>

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

Kafle

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. They can be accessed under this URL:

http://${s}.tiles.openrailwaymap.org/${style}/${z}/${x}/${y}.png

The placeholder ${s} can be replaced by a, b or c to create different domains for faster loading. This domain prefix can also be omitted.

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

Użycie w OpenLayers

var openrailwaymap = new OpenLayers.Layer.XYZ("OpenRailwayMap", ["http://a.tiles.openrailwaymap.org/standard/${z}/${x}/${y}.png","http://b.tiles.openrailwaymap.org/standard/${z}/${x}/${y}.png","http://c.tiles.openrailwaymap.org/standard/${z}/${x}/${y}.png"],
{
	sphericalMercator: true,
	opacity: 1,
	visibility: false,
	transparent: true,
	noOpaq: true,
	isBaseLayer: false,
	attribution: "<a href="http://www.openstreetmap.org/copyright">© OpenStreetMap contributors</a>, Style: <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA 2.0</a> <a href="http://www.openrailwaymap.org/">OpenRailwayMap</a> and OpenStreetMap"
});
map.addLayer(openrailwaymap);

Użycie w Leaflet

var openrailwaymap = new L.TileLayer('http://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png',
{
	attribution: "<a href="http://www.openstreetmap.org/copyright">© OpenStreetMap contributors</a>, Style: <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA 2.0</a> <a href="http://www.openrailwaymap.org/">OpenRailwayMap</a> and OpenStreetMap",
	minZoom: 2,
	maxZoom: 19,
	tileSize: 256
}).addTo(map);

Użycie w 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.

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.


Użyciw w QGIS

Możliwe jest użycie nakładek kafelkowych OpenRailwayMap w QGIS przy użyciu wtyczki poziomu skalowania mapy i następującej konfiguracji XML.
Symbol zastępczy ${style} należy zastąpić nazwą stylu renderowania. Spójrz na tabelę powyżej dla dostępnych nazw stylów.

<GDAL_WMS>
	<Service name="TMS">
		<ServerUrl>http://tiles.openrailwaymap.org/${style}/${z}/${x}/${y}.png</ServerUrl>
	</Service>
	<DataWindow>
		<UpperLeftX>-20037508.34</UpperLeftX>
		<UpperLeftY>20037508.34</UpperLeftY>
		<LowerRightX>20037508.34</LowerRightX>
		<LowerRightY>-20037508.34</LowerRightY>
		<TileLevel>19</TileLevel>
		<TileCountX>1</TileCountX>
		<TileCountY>1</TileCountY>
		<YOrigin>top</YOrigin>
	</DataWindow>
	<Projection>EPSG:3857</Projection>
	<BlockSizeX>512</BlockSizeX>
	<BlockSizeY>512</BlockSizeY>
	<BandsCount>4</BandsCount>
	<Cache>
		<Path>/tmp/cache_osm_rail</Path>
	</Cache>
</GDAL_WMS>

API

OpenRailwayMap udostępnia RESTful HTTP API, który ułatwia żądanie danych o kolejach w OpenStreetMap. Żądania są odbierane przez GET, wyniki zwracane są jako dane JSON.

Interfejs API obsługuje współdzielenie zasobów krzyżowych (CORS), wysyłając w nagłówku Access-Control-Allow-Origin: * dla każdej odpowiedzi.

Parametry adresu URL i elementy iframe

Dostępne języki — OpenRailwayMap/API
· Afrikaans · Alemannisch · aragonés · asturianu · Aymar aru · azərbaycanca · Bahasa Indonesia · Bahasa Melayu · bamanankan · Bân-lâm-gú · Basa Jawa · Basa Sunda · Baso Minangkabau · bosanski · brezhoneg · català · čeština · corsu · dansk · Deutsch · eesti · English · español · Esperanto · estremeñu · euskara · français · Frysk · Gaeilge · Gàidhlig · galego · Hausa · hrvatski · Igbo · interlingua · Interlingue · isiXhosa · isiZulu · íslenska · italiano · Kiswahili · Kreyòl ayisyen · kréyòl gwadloupéyen · kurdî · Latina · latviešu · Lëtzebuergesch · lietuvių · Limburgs · magyar · Malagasy · Malti · Nederlands · Nedersaksies · norsk · norsk nynorsk · occitan · Oromoo · oʻzbekcha/ўзбекча · Plattdüütsch · polski · português · română · shqip · slovenčina · slovenščina · Soomaaliga · suomi · svenska · Tagalog · Tiếng Việt · Türkçe · Türkmençe · Vahcuengh · vèneto · walon · Wolof · Yorùbá · Zazaki · isiZulu · српски / srpski · авар · Аҧсшәа · башҡортса · беларуская · български · қазақша · Кыргызча · македонски · монгол · русский · тоҷикӣ · українська · Ελληνικά · Հայերեն · ქართული · नेपाली · भोजपुरी · मराठी · संस्कृतम् · हिन्दी · অসমীয়া · বাংলা · ਪੰਜਾਬੀ · ગુજરાતી · ଓଡ଼ିଆ · தமிழ் · తెలుగు · ಕನ್ನಡ · മലയാളം · සිංහල · བོད་ཡིག · ไทย · မြန်မာဘာသာ · ລາວ · ភាសាខ្មែរ · ⵜⴰⵎⴰⵣⵉⵖⵜ · አማርኛ · 한국어 · 日本語 · 中文(简体)‎ · 中文(繁體)‎ · 吴语 · 粵語 · ייִדיש · עברית · اردو · العربية · پښتو · سنڌي · فارسی · ދިވެހިބަސް