Using the WebRequest class to query a map image from the WMS servlet

Query schemas for the xServer internet WMS adapter

The PTV WMS adapter provides a WMS (Web Map Service) interface for requesting maps rendered by PTV xMap Server. Currently the PTV WMS adapter supports version 1.1.1 and version 1.3 of OGC's (Open Geospatial Consortium) WMS specification. For detailed information about WMS, please visit OGS's web site at

The layers made available by the PTV WMS adapter can be queried using a capabilities request.

A request to query a WMS image usually looks like:,49.50647,6.36157,49.73065&format=image/png&version=1.1.1&layers=xmap-ajaxbg&srs=EPSG:4326&styles= 

Note: Requests using the layer “xmap-ajaxbg” are not billed. You do not need to specify a token for requests when using this profile. All other layers need an additional xtok parameter.

Query tiled maps

There is also a request schema which is optimized to query background layers in a shorter and more cache-friendly manner. These images are usually used by interactive map controls. The request schema is GetTile/{layer}/{x}/{y}{z}. For example:

The throughput can be increased by using the domain ajaxbg1-{cluster} instad of xmap-{cluster} as domain. This will bypass restrictions for parallel downloads per domain. An example request:

Load a map image in C#

To load a WMS image in C#, you can use the WebRequest class and initialize a System.Drawing.Image object from the response string.

public static void TestWebRequest()
    var request = WebRequest.Create(
        "&format=image/png&version=1.1.1&layers=xmap-plain&srs=EPSG:505456&styles=&xtok=<your token>");
    var response = request.GetResponse();
    var bitmap = System.Drawing.Image.FromStream(response.GetResponseStream());