PTV xMap Server is delivered with an example database (derby) containing points of interest (POI) in Luxemburg and configuration files which allow to immediately display petrol stations, restaurants, and some arbitrary geometries. Please see below for more information.
PTV xMap Server needs a configuration to describe the layout of the databases, which objects are available, and which mapping information apply. There is one configuration layout:
An xml file in the file system (usually the ptv xMap Server's conf folder) which is called <configuration>-geodatasource.xml
. How to configure the database for the geodatasource configuration.
The configuration's xml file is defined by an XML schema which contains the complete documentation, examples can be found in the conf folder. In order to validate your configuration file against the schema, please keep PTV xMap Server running and use this URL as described below.
The following document is an example of a simple configuration by an xml file (also see conf/default-geodatasource.xml
)
<?xml version="1.0" encoding="UTF-8"?> <GeoDatasource majorVersion="1" minorVersion="0" xmlns="http://www.ptv.de/com/ptvag/xserver/engines/xpoidbaccess" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ptv.de/com/ptvag/xserver/engines/xpoidbaccess http://localhost:50010/xmap/schema/1.0/GeoDatasource.xsd"> <Datasource driver="org.apache.derby.jdbc.ClientDriver" url="jdbc:derby://localhost:50016/poi" user="POI" password="POI"/> <Layers default="points-of-interest"> <LayerInfo name="points-of-interest" coordType="PTV_GEODECIMAL" table="T_DATA_POI"> <Profiles> <Profile name="default" filename="geodata-poi-default.xml"/> <Profile name="petrol-stations" filename="geodata-petrol-stations.xml"/> <Profile name="petrol-stations-alternative" filename="geodata-petrol-stations-alternative.xml"/> <Profile name="restaurants" filename="geodata-restaurants.xml"/> </Profiles> <AttributeMappings> <AttributeMapping attributeName="ID" columnName="ID" type="int"/> <AttributeMapping attributeName="X" columnName="X" type="int"/> <AttributeMapping attributeName="Y" columnName="Y" type="int"/> <AttributeMapping attributeName="COUNTRY" columnName="COUNTRY" type="String"/> <AttributeMapping attributeName="POSTALCODE" columnName="POSTALCODE" type="String"/> <AttributeMapping attributeName="STATE" columnName="STATE" type="String"/> <AttributeMapping attributeName="CITY" columnName="CITY" type="String"/> <AttributeMapping attributeName="CITY2" columnName="CITY2" type="String"/> <AttributeMapping attributeName="STREET" columnName="STREET" type="String"/> <AttributeMapping attributeName="HOUSENUMBER" columnName="HOUSENUMBER" type="String"/> <AttributeMapping attributeName="POINAME" columnName="POINAME" type="String"/> <AttributeMapping attributeName="PHONE" columnName="PHONENUMBER" type="String"/> <AttributeMapping attributeName="TYPE" columnName="FEATURECODE" type="String"/> <AttributeMapping attributeName="IMAGE" columnName="BILD" type="String"/> </AttributeMappings> </LayerInfo> <LayerInfo name="geometries" coordType="PTV_MERCATOR" table="T_DATA_GEOMETRIES"> <Profiles> <Profile name="default" filename="geodata-geometries.xml"/> <Profile name="alternative" filename="geodata-geometries-alternative.xml"/> </Profiles> <AttributeMappings> <AttributeMapping attributeName="ID" columnName="C_ID"/> <AttributeMapping attributeName="X" columnName="C_X"/> <AttributeMapping attributeName="Y" columnName="C_Y"/> <AttributeMapping attributeName="VALUE" columnName="C_INTVALUE"/> </AttributeMappings> <EngineParameters> <BoundingBox leftColumnName="C_XMIN" rightColumnName="C_XMAX" bottomColumnName="C_YMIN" topColumnName="C_YMAX"/> <Rendering geometryColumnName="C_WKBGEOMETRY" geometryType="WKB"/> </EngineParameters> </LayerInfo> <LayerInfo name="traffic" coordType="PTV_MERCATOR" table="T_DATA_TRAFFICINFO"> <Profiles> <Profile name="default" filename="geodata-traffic.xml"/> <Profile name="alternative" filename="geodata-traffic-alternative.xml"/> <Profile name="absolute" filename="geodata-traffic-absolute.xml"/> </Profiles> <AttributeMappings> <AttributeMapping attributeName="ID" columnName="C_ID"/> <AttributeMapping attributeName="X" columnName="C_X"/> <AttributeMapping attributeName="Y" columnName="C_Y"/> <AttributeMapping attributeName="CATEGORY" columnName="C_CATEGORY"/> <AttributeMapping attributeName="TEXT" columnName="C_DESCRIPTION"/> </AttributeMappings> <EngineParameters> <BoundingBox leftColumnName="C_XMIN" rightColumnName="C_XMAX" bottomColumnName="C_YMIN" topColumnName="C_YMAX"/> <Rendering geometryColumnName="C_WKBGEOMETRY" geometryType="WKB"/> </EngineParameters> </LayerInfo> <LayerInfo name="trafficKml" coordType="OG_GEODECIMAL" table="T_DATA_TRAFFICINFO_KML"> <Profiles> <Profile name="default" filename="geodata-traffic.xml"/> <Profile name="alternative" filename="geodata-traffic-alternative.xml"/> <Profile name="absolute" filename="geodata-traffic-absolute.xml"/> </Profiles> <AttributeMappings> <AttributeMapping attributeName="ID" columnName="C_ID"/> <AttributeMapping attributeName="X" columnName="C_X"/> <AttributeMapping attributeName="Y" columnName="C_Y"/> <AttributeMapping attributeName="CATEGORY" columnName="C_CATEGORY"/> <AttributeMapping attributeName="TEXT" columnName="C_DESCRIPTION"/> </AttributeMappings> <EngineParameters> <BoundingBox leftColumnName="C_XMIN" rightColumnName="C_XMAX" bottomColumnName="C_YMIN" topColumnName="C_YMAX"/> <Rendering geometryColumnName="C_KMLGEOMETRY" geometryType="KML"/> </EngineParameters> </LayerInfo> </Layers> </GeoDatasource>
The element Datasource
defines a database, where the data are available. The parameters are the jdbc-parameters driver for the database driver class, url for the database url, user for the database user and password for the database user password. In order to use a database driver different from derby, please install it to the shared/lib folder of PTV xMap Server.
Each layer which is a set of data belonging together is configured by an element LayerInfo. It has the attributes:
name
- the layer name. In this case there are layers with the layer name points-of-interests, geometries and traffic.
coordType
- the coordinate format type. Except for OG_SRID all types can be applied as for the PTV xMap Server requests: PTV_MERCATOR, OG_GEODECIMAL, PTV_GEODECIMAL, PTV_GEOMINSEC, etc.
Please note that for the Rendering geometryType KML only OG_GEODECIMAL can be used.
table
- the database table name
Furthermore, a set of profiles (see below) and a set of attributes must be defined. Mandatory attributes are ID, X, and Y which must be mapped to columns in the table configured above. Other attributes can be defined and used within the profile in order to map style elements. Please note that a columnName can be only used once in a AttributeMappings
element.
If a geometry is available, the column containing the geometry information is configured in the Rendering element in the EngineParameters
section: the column name is in the attribute geometryColumnName
and the geometry type is in the attribute geometryType
. Supported geometry types are WKB, WKT and KML. The recommended database layout for geometry columns is to use the database type BLOB for WKB geometries and to use the CLOB database type for WKT and KML geometry types.
Please note that for the geometryType
KML only the coordType OG_GEODECIMAL of the element LayerInfo
can be used.
Each profile configured in the Profiles
element must obtain a name and can obtain a filename. If the filename is present, it must contain the path to the profile file relative to the geodatasource file's path. Otherwise, the filename is assumed to be <name>.xml
. When requesting the default profile, the profile called default is used. If it is not present, the first profile in the list is used.
Information on how to display the geographic objects are stored in a GeoDataProfile. They comprise values such as icon names, color values, maximum display scales and much more. For the most flexible way of displaying data, these style values can also be dependent on database attribute values by using specific mappings.
The profile's xml file is defined by an XML schema which contains the complete documentation, examples can be found in the conf folder (here geodata-restaurants-luxemburg.xml
).
<?xml version="1.0" encoding="UTF-8"?> <GeoDataProfile majorVersion="1" minorVersion="0" xmlns="http://www.ptv.de/com/ptvag/xserver/engines/xpoidbaccess" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Filter> <SqlFilter>featurecode='7315'</SqlFilter> </Filter> <Style> <Point autoplacement="true"> <Description> <TextField attributeName="TYPE" separator="$§$"/> </Description> <Bitmap> <Name value="navteq/rest.bmp"/> </Bitmap> </Point> <GlobalInfo> <MaxScale value="1000"/> </GlobalInfo> </Style> </GeoDataProfile>
Each profile is automatically validated against the XML schema, validation errors are written to the log file and an exception is thrown. In order to fix the problem, please validate your profile against the schema, keep PTV xMap Server running and use this URL as xsi:schemaLocation as follows.
<GeoDataProfile xmlns="http://www.ptv.de/com/ptvag/xserver/engines/xpoidbaccess" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ptv.de/com/ptvag/xserver/engines/xpoidbaccess http://localhost:50010/xmap/schema/1.0/GeoDataProfile.xsd" majorVersion="1" minorVersion="0"/>
The profile can then automatically be validated by using tools such as Altova XMLSpy.
Profiles can be subclassed using the Parent tag. Example:
<GeoDataProfile ...> <Parent> geodata-base-profile </Parent>
In this example all information of the profile geodata-base-profile
is imported into the current profile.
Note that changes in a sub-profile always overwrite the parent's values. Also note that the parent profile is specified by the filename without the .xml extension.
A powerful feature of the profile is to map database attribute values to style values. See the mappings documentation of the XML schema for details. The KeyValueMappingMethod can, for example, be used to map distinct attribute values to distinct style values. In the following an example for petrol stations is given, that maps the content of the attribute TYPE to a bitmap name so that each major oil company can be displayed using its own icon, otherwise the default (navteq/7311.bmp) will be used.
<Bitmap> <Name value="navteq/7311.bmp" MappingMethod="KeyValueMappingMethod"> <AttributeName>TYPE</AttributeName> <Map> <Key>Aral</Key> <Value>navteq/aral.bmp</Value> </Map> <Map> <Key>Bp</Key> <Value>navteq/bp.bmp</Value> </Map> <Map> <Key>Esso</Key> <Value>navteq/esso.bmp</Value> </Map> <Map> <Key>Dea</Key> <Value>navteq/dea.bmp</Value> </Map> <Map> <Key>Jet</Key> <Value>navteq/jet.bmp</Value> </Map> <Map> <Key>Q8</Key> <Value>navteq/q8.bmp</Value> </Map> <Map> <Key>Shell</Key> <Value>navteq/shell.bmp</Value> </Map> <Map> <Key>Texaco</Key> <Value>navteq/texaco.bmp</Value> </Map> <Map> <Key>Total</Key> <Value>navteq/total.bmp</Value> </Map> </Name> </Bitmap>
To display petrol stations or restaurants, the SMOLayer element in the request only needs to contain the layer name and the geodatasource configuration. The latter is the <configuration> part of the filename <configuration>-geodatasource.xml, the layer name is configured in this file.
Please note that configuration default is always assumed if the configuration element in the request is empty. The following request displays petrol stations in the city of Luxembourg, using the profile name petrol-stations, the layer name points-of-interest, and the configuration default representing the configuration file default-geodatasource.xml.
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <renderMap xmlns="http://types.xmap.xserver.ptvag.com"> <MapSection_1 scale="500" scrollHorizontal="0" scrollVertical="0" zoom="0"> <center xmlns="http://xmap.xserver.ptvag.com"> <point x="681142" y="6369874" xmlns="http://common.xserver.ptvag.com" /> </center> </MapSection_1> <MapParams_2 showScale="true" useMiles="false" /> <ImageInfo_3 format="GIF" height="400" imageParameter="" width="400" /> <ArrayOfLayer_4> <Layer xsi:type="SMOLayer" name="default.points-of-interest.petrol-stations" visible="true" configuration="" objectInfos="REFERENCEPOINT" xmlns="http://xmap.xserver.ptvag.com" /> </ArrayOfLayer_4> <boolean_5>true</boolean_5> <CallerContext_6> <wrappedProperties xmlns="http://baseservices.service.jabba.ptvag.com"> <CallerContextProperty key="CoordFormat" value="PTV_MERCATOR" /> <CallerContextProperty /> <CallerContextProperty /> </wrappedProperties> </CallerContext_6> </renderMap> </soap:Body> </soap:Envelope>
As the geodatasource configuration can configure several profiles, the layer name can be formatted as follows: <configuration>.<layername>[.<profile>][;<SQL Filter>]
. If the profile is omitted, the default profile is the one called default
, if it exists, the first profile of the profile list, otherwise. In order to use the alternative profile for petrol stations, use layer name default.points-of-interest.petrol-stations-alternative
. Additionally, an SQL filter statement can also be added. When using attribute names, put it into brackets, such as [id] = 42
.
The SQL filter will be attached at the end of the WHERE clause. Valid expressions are comparisons (<, >, =, like, …). Concatenations of expressions are possible with the SQL operators AND and OR.
If you are currently using the SMOLayer element in combination with a database and want to update to the new technique, please note the following details:
It is now possible to have several SMOLayer elements all using different configurations in a single request. The layer name used for the object information is not called Smo2Layer anymore, instead the layer name from the request is used.
The configuration files have changed. Please contact your PTV representative for details.
Copyright © 2024 PTV Logistics GmbH All rights reserved. | Imprint