Generation of Map Images


Short description

The generation of map images is a process to visualize spatial information on a two-dimensional medium.


Calculated geographical data like 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. can be combined with static data like towns and road networks to get a better comprehension of the calculated data.

Detailed Consideration

Transformation into Images

Visualizing spatial information is a basic function for the most PTV xServer use cases. In general, this information is transformed from a spatial repository into an image like a JPG or PNG. This approach is used by the XMap operation renderMap. Alternatively, the whole visual map can be partitioned into separate tiles, allowing refreshes only for those parts of the map, which are not yet drawn, see operation getTile. This approach is preferred by already existing frameworks like Leaflet.

Image Generation Process

For a better understanding of the image generation and its involved coordinates and size specifications, three different levels, or better coordinate systems, exist:

Coordinate systems needed for generating a map.

The source of geographical data, maintained in geographical repositories, is shown by the blue-colored level. The resulting image of xMap generation calls are indicated by the red level and it is integrated in a final medium (see grayed level). The first level defines the source of spatial data, containing coordinates based on one of the EPSG coordinate formats. This can be set by means of RequestBase.coordinateFormat. Via the different map section classes, the visible area of a map can be defined by using coordinates of this geographical type.

Properties for the resulting image can be defined via the ImageOptions class. Most important is the width and height of the image in physical pixels. So, by increasing these sizes it is possible to reduce the number of requested tiles and the Internet traffic at all.

For future versions, the pixel resolution property will be part of the ImageOptions class. Via this property the destination resolution can be defined. It is necessary because many size specifications in the image are pixel based, i.e., they do not have any geographic aspect. As an example the font sizes in text labels can be mentioned. These pixel sizes have to be enlarged accordingly for higher resolution media. Without any modifications of the resolution parameter, the texts would shrink to an unreadable size.

Good to know

Defining a map section

There exist different classes for defining the geographical area, which should be shown in the map image:

  • Class MapSectionByTileKey: The required map section is described by a tile key, which consists of a zoom level and the x- and y-index in this level.
  • Class MapSectionByBounds: Concrete geographical coordinates define by means of a rectangle the bounds of the required map section.
  • Class MapSectionByCenter: A center coordinate and fractional zoom factor (or scale) are the parameters for a map section.