Adding an xServer internet map to QGIS

  • QGIS (previously known as "Quantum GIS") is a cross-platform free and open-source desktop geographic information systems (GIS) application that provides data viewing, editing, and analysis capabilities. This section shows how to add xServer internet as basemap to a QGIS project, so you can combine it with your application content.

Set up the "on the fly" CRS transformation for your project

  •  

    To get the best quality and performance, you should set up your project CRS to Spherical Mercator, called "Pseudo Mercator" within QGIS. Go to Project->Project Properties->CRS and check  "Enable on the fly CRS transformation". Then select "WGS 84 / Pseudo Mercator". You can also set Spherical Mercator as default CRS for all new projects under Settings->Options->CRS.

    The text on the bottom right footer of the window should be "EPSG:3857" then.

Create a new WMS connection

  •  

    Go to Layer->Add WMS/WMTS Layer and dlick "New". Set a name, e.g. "xMap", and as URL

    "https://xmap-eu-n-test.cloud.ptvgroup.com/WMS/WMS?xtok=<your token>"

    Then click "OK"

The single layer method

  •  

    The single layer method just pulls the xMapServer basemap via WMS as one single QGIS layer. You can add you own content on top of it then.

    On the WMS sheet, go to "Layers" and click "Connect". A list of available layers appears. Select "xmap-plain"; for image encoding set "PNG".

    Now you have your xMapServer basemap inside QGIS. You can add any other QGIS content on top of it.

The dual layer method

  •  

    An advanced method is to use two layers: One for the basemap background and one for the foreground. The benefit is that you can embed QGIS content between the two basemap layers and keep the basemap labels on top. For the dual layer method you can also choose between three basemap styles: Default, Silkysand and Sandbox. Another benefit is a better performance, because the background layer content can be fetched using tiles and cached inside QGIS.

    For the two layer method, first add a WMS background layer, e.g. "xmap-sandbox-bg". Set the image encoding to PNG and the tile size to 256x256 like in the screenshot. After adding the background layer, add a foregrund layer, e.g. "xmap-sandbox-fg", but without any tile size parameters. Now you have a basemap composed of two layers which can be set visible independently and allow to embed any other QGIS layer in-between.

    Because the -bg and -fg layers don't render a server-side attribution text, we have to render it client-side. Go to View->Decorations->Copyright Label, enable the copyright text, and set as text "&copy; PTV, TOMTOM".

    Now you can add any other content, for example a shape file, and embed it between the background and foreground layer.