Map Tile API
Characteristic
Short description
With the PTV xMap service REST REST (Representational State Transfer) represents a World Wide Web paradigm, consisting of constraints to the design of components which results in a better performance and maintainability. API for map tiles you are able to use de facto standards in web mapping to display interactive maps by using map tiles instead of a single map image.
Use
It is important to understand that the PTV xMap service only provides the map tiles. Any user interaction must be implemented on the client side, for example by using an existing JavaScript toolkit.
Detailed Consideration
Map Tiles
By using map tiles the displayed map is not requested as a single image but assembled from several map tiles with a default size of 256x256 pixels. The client application only requests the map tiles needed for the current map view. Whenever the map view changes (by zooming or panning), the application must only request the tiles that come into view but not the entire map.
The tiles generated by the PTV xMap service are delivered through a Representational State Transfer REST (Representational State Transfer) represents a World Wide Web paradigm, consisting of constraints to the design of components which results in a better performance and maintainability. (REST) API. REST is a pattern for simple stateless client-server protocols (see Wikipedia for an introduction). In the case of PTV xMap service, only GET requests for retrieving the individual tiles are supported.
Identification of map tiles
- Every map tile belongs to a zoom level z=0, 1, 2, … . These levels are related to each other by a factor of two in scale. The zoom level also determines how many tiles are needed to display the entire world. At z=0 the entire world is displayed in a single tile. At z=1, 2x2=4 tiles are needed to display the entire world, and so on.
- Every map tile is uniquely identified by the tuple z/x/y consisting of the zoom level z and the coordinates x (horizontal) and y (vertical) which are also part of the URL of the appropriate map tile.
- The coordinates x and y range from 0 to 2z-1. So zoom level z=0 consists only of the tile 0/0/0. At z=1, the four tiles are 1/0/0, 1/0/1, 1/1/0 and 1/1/1. The tile z/0/0 is always the top left tile of its respective zoom level.
You can also check out this interactive map, where tiles are shown as an overlay in the map.
Projection and coordinate system
Displaying the (approximately ellipsoidal) surface of the earth on a flat surface, such as a computer screen, requires the use of a projection. PTV xMap service employs the Web Mercator (EPSG:3857) projection, which is the de-facto standard for web mapping. It is based on the WGS84 coordinate system. Check Coordinate Systems for further information about coordinate systems in the PTV xServer environment.
Addressing a map tile
The URL pattern of a map tile is http://hostname:50000/services/rest/XMap/tile/{z}/{x}/{y}
(note the order of the parameters). This is the information you need to supply to your toolkit to have it display map tiles from the PTV xMap service.
Distance matrices are organized in columns and rows, squared and rectangular matrices are possible.
Good to know
Use Case
Check the use case Displaying a basic interactive map for information about the usage of map tiles, including an example using the Leaflet toolkit.
If you use the Leaflet toolkit together with a hatch configuration for Feature Layers it works only with image standard sizes like 128x128, 256 x 256, 512x512 or 1024x1024. If you use other images sizes you will get a hatch displacement at the image border.