Displaying Feature Layer PTV_PreferredRoutes

The Feature Layer "PTV_PreferredRoutes" contains information about routesClosed A route corresponds to a path of a vehicle through the underlying transport network. The main attributes of a route are the distance and the time that the vehicle travels along the path., which are preferable for long trucks, heavy load transport etc. This information can be used to visually distinguish these routes, when rendering your map. You may find out more about this Feature Layer in our dedicated chapter.


This Feature Layer gives you the ability to visually highlight certain types of roads. Via XML profilesClosed A profile is a collection of parameters used to configure the request. Full profiles consist of a number of specialized sub-profiles like the VehicleProfile which describes the properties of a vehicle., you may also control which roads are highlighted and how (e.g. color).


In order to render maps, you need a PTV xMap server and a digital map of the area.

Additionally your map needs to have the Feature Layer "PTV_PreferredRoutes" installed.

Configuration Guide

Check if the following prerequisites are fulfilled before you start with the use case:

  • Installed and licensed PTV xMap Server
  • Installed PTV Map
  • Installed and licensed Feature Layer theme PTV_PreferredRoutes

Programming Guide

When using the RESTClosed 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 to build a tiled map, the REST operation tile is part of the following URL, by means individual tiles can be requested:


Concrete values in URL template have to be passed for zoomlevel, x and y coordinates, specifying the map section of the corresponding tile.

To display PTV_PreferredRoutes on a map with common content, the parameter layers has to be specified in the URL enabling all base layers and PTV_PreferredRoutes.


To obtain a map which contains only PTV_PreferredRoutes, the parameter layers has to be specified in the URL enabling only PTV_PreferredRoutes.


To display only a subset of types by PTV_PreferredRoutes, the parameter preferredRouteTypes has to be specified in the URL. The available types can be requested through the xRuntime service and are documented in the manual as layer-specific properties of the feature layer PTV_PreferredRoutes. If this parameter isn't present, all types of PTV_PreferredRoutes are displayed.



In the example below, which is based on the one from Displaying a Basic Interactive Map, Preferred Routes are displayed on a tiled map using the Leaflet toolkit:

var map = new L.Map('map', { center: [49.61, 6.125], zoom: 13 }); // Add layer with PTV map and Feature Layer Preferred Routes var tileUrl = xServerUrl + '/services/rest/XMap/tile/{z}/{x}/{y}?storedProfile=silkysand&layers=labels,transport,background,PTV_PreferredRoutes'; new L.TileLayer(tileUrl, { minZoom: 3, maxZoom: 18, noWrap: true }).addTo(map);

Related Topics

The following topics might be relevant for this use case.