xRoute2 - featureLayerProfile in profile.xml

This forum deals with any kind of routing computation whether it is simple A:B-routing, calculation of isochrones, simple matrix computation or nearest search.
Post Reply
sulcji
Posts: 4
Joined: Fri Feb 05, 2021 9:58 am

xRoute2 - featureLayerProfile in profile.xml

Post by sulcji »

Hello,

we use PTV (xServer2.27) as GIS for third party software which we have some (but limited) options do modify.
Can we add featureLayerProfile in profile.xml?
Im getting error:

Code: Select all

"message": "Could not parse profile. Reason: Error at line 62, column 11: element 'featureLayerProfile' is not allowed for content model '(description?,vehicleProfile?,featureLayerProfile?,routingProfile?,renderingProfile?,clusterPlanningProfile?)'."
when I insert featureLayerProfile into xml.

When default profile is used and I only modify (append requestProfile-featureLayerProfile-themes) the request - then the response is OK and blocked roads are shown.

In more detail:
Customer requests using PTV_TrafficIncidents to not route trough closed roads.
Mentioned third party software uses following modules:
- xDima
- xMap
- xRoute
In order to modify behaviour of all three modules at one place - and keep them providing same results (ie. when dima calculate route avoiding closed road, then additional xroute request should avoid this closed road too) I would like to insert featureLayerProfile into profile.xml instead of (maybe impossible for us) modification of xDima/xMap/xRoute requests from third party application.

Ive managed to set up ContentUpdateService and via RawRequest runner Im able to modify requests (adding requestProfile) - and it is working correctly (map shows blocked roads)

Code: Select all

{
  "mapSection": {
    "$type": "MapSectionByCenter",
    "centerCoordinate": {
      "x": 15.055,
      "y": 50.750
    },
    "zoom": 13
  },
  "imageOptions": {
    "width": 1280,
    "height": 800
  },
  "storedProfile": "classic",
  "requestProfile": {
    "featureLayerProfile": {
      "themes": [
        {
          "id": "PTV_TrafficIncidents",
          "enabled": "true"
        }
      ]
    }
  }
}
But Im struggling to insert featureLayerProfile-themes to profile xml.
See attached file default2.xml
Without last section:

Code: Select all

	<featureLayerProfile>
		<themes id="PTV_TrafficIncidents" enabled="true" />
	</featureLayerProfile>
the profile is working.

At the end of the post is request which i run in RawRequestRunner of PTV xserver2.
(Route should avoid the main road, which is closed for last 1 or 2 years - as first map request in this post shows that road is blocked)

Please can you advise if I can modify profile.xml instead of adding RequestProfile to each of request to xmap/xroute/xdima?
Thank you

Code: Select all

{
    "storedProfile": "default2",
    "coordinateFormat": "EPSG:4326",
    "waypoints": [
        {
            "$type": "OffRoadWaypoint",
            "location": {
                "offRoadCoordinate": {
                    "x": 15.0531983,
                    "y": 50.7412225
                }
            }
        },
        {
            "$type": "OffRoadWaypoint",
            "location": {
                "offRoadCoordinate": {
                    "x": 15.0728858,
                    "y": 50.7478147
                }
            }
        }
    ],
    "routeOptions": {},
    "requestProfile": {},
    "resultFields": {
        "eventTypes": [],
        "polyline": "true"
    }
}
Attachments
default2.xml
(3.04 KiB) Downloaded 56 times
Maximilian Vogel
Posts: 11
Joined: Fri Dec 29, 2017 9:00 am

Re: xRoute2 - featureLayerProfile in profile.xml

Post by Maximilian Vogel »

Hello,

yes, you can add the featureLayerProfile to the XML profile files. The XML files are validated against a schema definition and this validation produced the error message that you posted:

Code: Select all

"message": "Could not parse profile. Reason: Error at line 62, column 11: element 'featureLayerProfile' is not allowed for content model '(description?,vehicleProfile?,featureLayerProfile?,routingProfile?,renderingProfile?,clusterPlanningProfile?)'."
Unfortunately, the error message doesn't state that the order is relevant. If you put your featureLayerProfile between vehicleProfile and routingProfile, it will work.

Concerning your xRoute request I suggest to read the technical concept about time consideration. Without specifying a time consideration mode that uses some sort of reference time, the blockings won't be considered even if you activate the layer PTV_TrafficIncidents.
Maximilian Vogel
Developer
PTV Logistics
sulcji
Posts: 4
Joined: Fri Feb 05, 2021 9:58 am

Re: xRoute2 - featureLayerProfile in profile.xml

Post by sulcji »

Thank you for swift reaction and finding cause of problem.

Regarding timeConsideration:
Since this is being attribute of request ( RouteOptions->TimeConsideration ) is my understanding correct that only modification of profile.xml (adding FeatureLayer) is not sufficient and we need to modify request when calling xDima or xRoute module or:

1) is there a way how to add time consideration into profile? ("now" time is sufficient)
2) calling of xroute/xdima cannot behave like calling xmap (in my first request) that shows traffic blockage even without specifying time?

Thank you
User avatar
Bernd Welter
Site Admin
Posts: 2574
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: xRoute2 - featureLayerProfile in profile.xml

Post by Bernd Welter »

Hello Sulc,

I recommend that you evaluate the following showcase Visualize Time-dependent Feature Layer Data which perfectly shows the behaviour of attributes through the TimeConsideration modes NONE / Snapshot / Timespan.
1. PTV_TruckAttributes: time dependent restriction  (forbidden during the night, area of the hospital)<br />2. PTV_TrafficIncidents: a time dependent impact (construction site)<br />3. PTV_TruckAttributes: a time INDEPENDENT height restriction due to a tunnel
1. PTV_TruckAttributes: time dependent restriction (forbidden during the night, area of the hospital)
2. PTV_TrafficIncidents: a time dependent impact (construction site)
3. PTV_TruckAttributes: a time INDEPENDENT height restriction due to a tunnel
So if you transfer this to routing we can conclude:
  • if you do not specify a TimeConsiderationMode only those attributes are considered which are "time independent" (no matter whether we talk about truck attributes, traffic incidents or any other category with time dependent contribution)
  • For speed patterns the visualization with TimeConsideration=NONE doesn't make sense: speed patterns are time dependent by design ;-)
And as Max mentioned: please check the Technical Concept: Time Consideration.

Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
Post Reply