Technical Concepts > About Feature Layer Rendering

About FeatureLayer Rendering

The FeatureLayer technology expands the routing network with new data content to be used in route calculation.

Of course additional FeatureLayer data can not only be used by the PTV xRoute server in route calculation, but it also can be used with PTV xMap server to visualise this additional data on the map. To emphasise the calculated routing result by visualising the relevant information on the map, the technology allows the definition of different individual and configurable rendering filters and styles for each FeatureLayer theme.

As for the routing use case the layers can be combined, individually selected and prioritised. Even the FeatureLayer rendering can be controlled with the snippet mechanism. This means that with only a few parameters, a client-side request defines which layers are to be visualised on the map.

Benefits

The FeatureLayer rendering offers some opportunities:

Prerequisites

Each FeatureLayer theme must be licensed separately by the license key xmap.featureLayerThemes. For further information please contact your PTV representative.

Basic Configuration of FeatureLayer Rendering

FeatureLayer themes can be enabled and disabled either by server profile or XML snippet. PTV xMap Server ships with two default profiles default.xml and sandbox.xml located in the conf/profiles directory. These default profiles are specifying preconfigured styles for all currently available FeatureLayer themes. You find the currently available themes here

.

In the default profiles all themes are initially disabled. Featurelayer themes can be enabled and disabled either by server profile or XML snippet. Each of these profiles is implicitely linked to its corresponding xmap profile. This means xmap-<profilename>.properties is linked to its corresponding <profilename>.xml FeatureLayer style profile.

xmap profilexmap xml FeatureLayer profile
conf/xmap-sandbox.propertiesconf/profiles/sandbox.xml
conf/xmap-default.propertiesconf/profiles/default.xml

The conf/profiles/default.xml file is used also as default profile if no profile name is given at all.

 

The feature layer xml profile (see example below) in general which is described below is composed of two major XML elements:

The FeatureLayer element (which is the same as in PTV xRoute, PTV xTour and PTV xDima) is used to enable or disable FeatureLayer themes, while the rendering element is used to configure the filters and style of the different FeatureLayer themes, for different countries. For detailed description see documentation of the complete rendering element

<Profile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
 <FeatureLayer majorVersion="1" minorVersion="0">
  <GlobalSettings enableTimeDependency="true"/>
  <Themes>
    <Theme id="ThemeA" enabled="true"/>
    <Theme id="ThemeB" enabled="false"/>
     ...
  </Themes>
  </FeatureLayer>
  <Rendering majorVersion="1" minorVersion="0">
   <Country id="*">
    <Theme id="ThemeA">
     <Class name="ClassNameA1">
      <Filter> ... </Filter>
      <Style> ... </Style>
     </Class>
     <Class name="ClassNameA2">
      ..
     </Class>
      ...
     </Theme>
     <Theme id="ThemeB">
      ...
     </Theme>
    </Country>
   </Rendering>
</Profile>

All available FeatureLayer themes are disabled per default in the two pre-configured profiles shipped with the PTV xMap server. It is recommended to use an appropriate XMLSnippet to switch on or off single or multiple FeatureLayer themes for rendering. The snippet below represents a valid XMLSnippet which can be used to enable the PTV_SpeedPatterns theme for rendering using the preconfigured filters and styles defined in the default.xml FeatureLayer profile. Please note that for a correct use of all timedependent FeatureLayer themes (like PTV_SpeedPatterns) timedependency needs to be enabled either in the server profile or the XMLsnippet.

<Profile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
 <FeatureLayer majorVersion="1" minorVersion="0">
  <Themes>
   <Theme id="PTV_SpeedPatterns" enabled="true"/>
  </Themes>
 </FeatureLayer>
</Profile>

Rendering

The Rendering element is composed of a list of Country element specifying the filters and styles per Theme which should be used to render the FeatureLayer data on the map.

<Profile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
 <FeatureLayer majorVersion="1" minorVersion="0">
  ...
 </FeatureLayer>
 <Rendering majorVersion="1" minorVersion="0">
  <Country id="*">
   <Theme id="PTV_SpeedPatterns">
    <Class name="HeavyTraffic">
     <Filter> ... </Filter>
     <Style> ... </Style>
    </Class>
    <Class name="DenseTraffic">
     ...
    </Class>
     ...
   </Theme>
   <Theme id="PTV_PreferredRoutes">
    ...
   </Theme>
  </Country>
 </Rendering>
</Profile>

Class

Within a Theme element Filters and Styles can be grouped into a list of named Classes, which are evaluated sequentially in the order they occur in the profile.

Filter

Within the Filter element (see example below) a list of condition elements can be used to limit the FeatureLayer rendering to be applied only to specific street types . If any condition element in the condition list evaluates to true the defined style is applied for the corresponding class. Looking at the example below the first condition can be interpret as the following 3 terms.

If a street segment fulfils the following 3 points then the corresponding style will be applied by the FeatureLayer rendering.

<Filter>
  <Condition displayClass="LevelOfService" streetType="MOTORWAY_FREEWAY">
    <Range values="51-70"/>
  </Condition>
  <Condition displayClass="LevelOfService" streetType="LOCAL_MAJOR_ROAD">
    <Range values="51-70"/>
  </Condition>
</Filter>
<Style>
...
</Style>

In a condition element only the displayClass attribute is required. If no specific streetType is defined and the optional attribute streetType is omitted no filter on streetTypes will be applied.

The displayClass Name and its corresponding Range values are data specific and FeatureLayer theme dependent. To get known which FeatureLayer theme returns which corresponding displayClass names and Values as well as their semantic interpretation refer to the corresponding metainfo description for the themes SET_DISPLAY_CLASS rules (ptvSP_DC_*).
For example: RuleId ptvSP_DC_0 is defined like "Returns a display class named LevelOfService, with the actual percentage of the freeflow speed, at a given datetime."

Styles

The Style element defines which style should be applied to a certain Geometry on which displayRange if the corresponding Filter evaluates to true:

<Filter>
  ...
</Filter>
<Style>
 <Geometry displayRange="9-14">
  <RenderLevel renderOffset="+10"/>
  <Stroke color="#704A4B" transparency="50" perpendicularOffset="0%" width="180%"/>
  <Icon displayRange="9-15" url="./bitmaps/Icon.bmp"/>
 </Geometry>
 <Geometry displayRange="15-23">
  <RenderLevel renderOffset="+10"/>
  <Stroke color="#704A4B" transparency="80" perpendicularOffset="0%" width="200%"/>
  <Icon displayRange="16-22" url="./bitmaps/other_Icon.bmp"/>
 </Geometry>
</Style>

The Style element is composed by a list of Geometry elements which are specifying the styles. Each Geometry element can define different styles on different zoom levels specified with the required attribute displayRange. DisplayRanges are exclusively described in zoom levels following the de-facto standard of the Google Tiling Scheme definition .

Ranges for ZoomLevels and DisplayValues are given as Strings. To see which syntax these strings need to fullfil and how they are interpreted see in the Rendering.xsd

Lists/Arrays of Country definitions, Filter Conditions and Geometry specifications are evaluated in the order they occur. Overlapping ranges in the same profile are evaluated in the order they occur. Only the first condition which is met will be applied in the order they occur

RenderLevel

The RenderLevel element is used to control the render priority of different FeatureLayer decorations.

The renderOffset number is also used to control the render priority of FeatureLayer themes among themselves. Like this it is possible to render segments of ThemeA on top of the segments of ThemeB.

Stroke

The Stroke element controls how the stroke should appear in the map. The appearance is defined through the following attributes.

Widths/perpendicularOffset are defined either as percentage denoted with <DIGITS>% according to the current streetwidth (depending on the streettype the style should be applied) or in pixel denoted with <DIGIT>px where the number of pixels are added to the width of the according street. Negative values are not supported

Icon

The Icon element defines which symbol should be displayed on the map. With the help of the DisplayRange attribute it is also possible to display different type of icons at different zoom levels. DisplayRange is exclusively described in zoom levels following the de-facto standard of the Google Tiling Scheme definition. The appearance of a symbol can be configured by following attributes:

Note that the path of the url attribute is a relative path outgoing from the bitmap.path attribute set in the xmap.properties file (default:bitmap.path=data\bitmaps). The properties file is located at: ..\xMap\conf\xmap.properties.

Inheritance Between Countries

The styles for rendering FeatureLayer data are defined in the Rendering element of the XMapProfile.xsd. Country specific definitions do either account for all countries - denoted by id="*" - or for single countries - denoted by their two-digit country code as id, for example id="49" for Germany.

Attributes and elements that are not explicitely set in a definition for a single country are inherited from the definition for all countries, if present. Otherwise, the country specific settings inherit the default values that are specified in the XMapProfile.xsd.

Example based on the xMap default profile

Base profile (parent)

Let's assume there is the following profile definition for all countries (id="*") that is used as base profile for PTV xMap Server. The following profile example is extracted from default.xml.:

<Profile>
 <Rendering majorVersion="1" minorVersion="0">
  <Country id="*">
   <Theme id="PTV_RestrictionZones">
    <Class name="TruckTransitZones">
     <Filter>
      <Condition displayClass="RestrictionZone">
       <Range values="0-200"/>
      </Condition>
     </Filter>
     <Style>
      <!-- display PTV_RestrictionZones above the street and in brown red for all countries -->
      <Geometry displayRange="9-14">
        <RenderLevel renderOffset="+10"/>
        <Stroke color="#704A4B" transparency="50" perpendicularOffset="0%" width="180%"/>
      </Geometry>
      <Geometry displayRange="15-23">
        <RenderLevel renderOffset="+10"/>
        <Stroke color="#704A4B" transparency="80" perpendicularOffset="0%" width="200%"/>
      </Geometry>
     </Style>
    </Class>
   </Theme>
  </Country>
 </Rendering>
</Profile>
		

 

Specific profile (child)

Now assume there is a specific profile definition for Germany (id="49") that changes color and renderOffset for the display of PTV_RestrictionZones. The specific profile is called 'mychild.xml' and sets default.xml as parent profile.

<Profile parent="default">
 <Rendering majorVersion="1" minorVersion="0">
  <Country id="49">
   <Theme id="PTV_RestrictionZones">
    <Class name="TruckTransitZones">
     <Style>
      <!-- display PTV_RestrictionZones below the street and in turqois for Germany -->
      <Geometry displayRange="9-14">
       <RenderLevel renderOffset="-2"/>
       <Stroke color="#2DAEC4"/>
      </Geometry>
        <Geometry displayRange="15-23">
        <RenderLevel renderOffset="-2"/>
       <Stroke color="#2DAEC4"/>
      </Geometry>
     </Style>
    </Class>
   </Theme>
  </Country>
 </Rendering>
</Profile>

 

If the profile 'mychild.xml' is used, renderOffset and color will be changed in Germany, but not for the rest of the countries. Elements and attributes that are not explicitely defined, that means all parameters apart from renderOffset and color, will be inherited from the definition for all countries in the parent profile .

The resulting effective profile after the application of child and parent looks as follows:

<Profile>
 <Rendering majorVersion="1" minorVersion="0">
  <Country id="*">
   <Theme id="PTV_RestrictionZones">
    <Class name="TruckTransitZones">
     <Filter>
      <Condition displayClass="RestrictionZone">
       <Range values="0-200"/>
      </Condition>
     </Filter>
     <Style>
       <!-- display PTV_RestrictionZones above the street and in brown red for all countries -->
       <Geometry displayRange="9-14">
        <RenderLevel renderOffset="+10"/>
        <Stroke color="#704A4B" transparency="50" perpendicularOffset="0%" width="180%"/>
       </Geometry>
       <Geometry displayRange="15-23">
        <RenderLevel renderOffset="+10"/>
        <Stroke color="#704A4B" transparency="80" perpendicularOffset="0%" width="200%"/>
       </Geometry>
     </Style>
    </Class>
   </Theme>
  </Country>
  <Country id="49">
   <Theme id="PTV_RestrictionZones">
     <Class name="TruckTransitZones">
      <Filter>
       <Condition displayClass="RestrictionZone">
        <Range values="0-200"/>
       </Condition>
      </Filter>
      <Style>
       <!-- display PTV_RestrictionZones below the street and in turqois for Germany -->
       <Geometry displayRange="9-14">
      <RenderLevel renderOffset="-2"/>
       <Stroke color="#2DAEC4" transparency="50" perpendicularOffset="0%" width="180%"/>
      </Geometry>
      <Geometry displayRange="15-23">
       <RenderLevel renderOffset="-2"/>
       <Stroke color="#2DAEC4" transparency="50" perpendicularOffset="0%" width="180%"/>
      </Geometry>
     </Style>
    </Class>
   </Theme>
  </Country>
 </Rendering>
</Profile>

 

Overwrite parent settings (extended child)

Assume that the child profile mychild.xml used in the previous example is extended with a definition that overwrites the color and transparency settings for all countries from the parent profile. The explicit definition for Germany will only be affected for parameters that are inherited from the parent profile. In this case, the color value remains the same, since it was defined in the specific profile for Germany, whereas the transparency value changes according to the extended profile.

<Profile parent="default">
  <Rendering majorVersion="1" minorVersion="0">
   <Country id="*">
    <Theme id="PTV_RestrictionZones">
     <Class name="TruckTransitZones">
      <Style>
       <!-- now display PTV_RestrictionZones in green without transparency for all countries -->
       <Geometry displayRange="9-14">
         <Stroke color="#48BC39" transparency="0"/>
       </Geometry>
       <Geometry displayRange="15-23">
        <Stroke color="#48BC39" transparency="0"/>
       </Geometry>
       </Style>
      </Class>
     </Theme>
    </Country>
    <Country id="49">
     <Theme id="PTV_RestrictionZones">
      <Class name="TruckTransitZones">
      <Style>
        <!-- still display PTV_RestrictionZones below the street and in turqois for Germany -->
        <Geometry displayRange="9-14">
         <RenderLevel renderOffset="-2"/>
         <Stroke color="#2DAEC4"/>
        </Geometry>
        <Geometry displayRange="15-23">
         <RenderLevel renderOffset="-2"/>
         <Stroke color="#2DAEC4"/>
        </Geometry>
       </Style>
      </Class>
     </Theme>
    </Country>
   </Rendering>
  </Profile>
		

 

If the extended child profile is applied, the color changes for all countries, except for Germany. Since the profile definition for Germany (child) does not set the Stroke transparency, its value is inherited from the definition for all countries (extended child). The resulting effective profile looks as follows:

  <Profile>
    <Rendering majorVersion="1" minorVersion="0">
     <Country id="*">
      <Theme id="PTV_RestrictionZones">
       <Class name="TruckTransitZones">
        <Filter>
         <Condition displayClass="RestrictionZone">
          <Range values="0-200"/>
         </Condition>
        </Filter>
        <Style>
         <!-- display PTV_RestrictionZones above the street, in green, and
          without transparency for all countries -->
         <Geometry displayRange="9-14">
          <RenderLevel renderOffset="+10"/>
         <Stroke color="#48BC39" transparency="0" perpendicularOffset="0%" width="180%"/>
         </Geometry>
         <Geometry displayRange="15-23">
          <RenderLevel renderOffset="+10"/>
          <Stroke color="#48BC39" transparency="0" perpendicularOffset="0%" width="200%"/>
         </Geometry>
        </Style>
       </Class>
      </Theme>
     </Country>
     <Country id="49">
      <Theme id="PTV_RestrictionZones">
       <Class name="TruckTransitZones">
        <Filter>
         <Condition displayClass="RestrictionZone">
          <Range values="0-200"/>
         </Condition>
        </Filter>
       <Style>
         <!-- display PTV_RestrictionZones below the street, in turqois, and
         without transparency for Germany -->
         <Geometry displayRange="9-14">
          <RenderLevel renderOffset="-2"/>
          <Stroke color="#2DAEC4" transparency="0" perpendicularOffset="0%" width="180%"/>
         </Geometry>
         <Geometry displayRange="15-23">
          <RenderLevel renderOffset="-2"/>
          <Stroke color="#2DAEC4" transparency="0" perpendicularOffset="0%" width="180%"/>
        </Geometry>
       </Style>
       </Class>
      </Theme>
     </Country>
    </Rendering>
  </Profile> 
		

The Parent Mechanism in Rendering Profiles

Even though there are some particularities for rendering the UPM parent mechanism is implemented for rendering profiles, too.

Looking at the rendering xsd the unique keys for the parent mechanism in the different XSD Levels are

ElementAttribute
Countryid
Themeid
Classname
GeometrydisplayRange