Coordinates Concept |
The map and other components of PTV xServer .NET work with 'real world coordinates'. This chapter describes the concepts behind those coordinates and their corresponding spatial reference systems.
This page contains the following sections:
When working with PTV xServer .NET, you most likely get in touch with real world coordinates, e.g. when positioning the map to a certain location. Generally, in terms of coordinates, the API of PTV xServer .NET figuratively comes in two flavors:
The first method, SetMapLocation(Point, Double), uses the PTV xServer .NET default spatial reference system for its Point parameter. The default spatial reference system is WGS84, also known as OGC_GEODECIMAL (PTV xServer) or EPSG:4326. WGS84 was chosen as the default for PTV xServer .NET as it is widely spread, commonly used in APIs and unique in its meaning (compared to the ambiguous term "Mercator").
Coordinates using the default spatial reference system are simply defined as "lat/lon values", with x being the longitude and y being the latitude. Some examples:
Location | Coordinate, WGS84 |
---|---|
Karlsruhe | { x=8.3798, y=49.0091 } |
Munich | { x=11.5768, y=48.1368 } |
Berlin | { x=13.4058, y=52.5191 } |
The second method, SetMapLocation(Point, Double, String), takes an additional string parameter that explicitly specifies the spatial reference system of the Point parameter. This string parameter is expected to contain a so-called spatial reference identifier, better known as 'EPSG code'. This code is just a short code used internally to determine the map projection parameters when a transformation of coordinates is processed. Example codes:
Code | Description |
---|---|
EPSG:4326 | Refers to WGS84. |
EPSG:31467 | Refers to 3-degree Gauß-Krüger, zone 2. |
EPSG:3857 | Refers to Popular Web Mercator, also known as Google Mercator. This is not the same as PTV Mercator. |
PTV_MERCATOR | Non-standard code for PTV Mercator. Refer to CoordinateReferenceSystemXServer or CoordinateReferenceSystemMapserver for more information on specific PTV codes. |
The "Spatial Reference Identification System" itself is defined by the European Petroleum Survey Group (EPSG) standard, which is a set of standards developed for cartography, surveying, and geodetic data storage. This standard is owned by the Oil and Gas Producers (OGP) Surveying and Positioning Committee and nowadays incorporated in most software projects dealing directly or indirectly with coordinates.
At the very base, PTV xServer .NET uses PROJ.4 for its coordinate transformation - encapsulated, enriched and simplified through the classes provided in Ptv.Components.Projections. This coordinate transformation incorporates a database taken from the PTV Mapserver project providing a huge set of spatial reference systems. For compatibility reasons, additional aliases for Mapserver and PTV xServer 'coordinate systems' have been added to the database as well. Please refer to the API documentation of Ptv.Components.Projections for more details on coordinate transformation. A good online resource for browsing spatial reference systems and finding spatial reference identifiers is spatialreference.org.
You will find the concept of coordinates defaulting to WGS84 while still being relatable to specific spatial reference systems throughout PTV xServer .NET. Sometimes additional parameters are used to specify spatial reference identifiers, like in the example above. Sometimes additional properties allow to override the default.