Hello there,
I got the following request:
There is a bigger extended route inside of Germany (~8k km) and my boss wants to know the driven distance per road type. E.g. how many kilometers on the autobahn, state roads, country roads or city roads
But I could calculate only the toll and total distance via ExtendedRoute in our Java Enviroment.
Is this possible via XRoute?
Thanks in advance!
BR,
Fabian
XRoute - determine distance for different kind of roads
- Bernd Welter
- Site Admin
- Posts: 2695
- Joined: Mon Apr 14, 2014 10:28 am
- Contact:
Re: XRoute - determine distance for different kind of roads
Hello Fabian,
aggregating the distances and periods per NC is simple, just use the property perNCRouteInfo of the CountryInfo and sum them up in the way you like:
Best regards,
Bernd
aggregating the distances and periods per NC is simple, just use the property perNCRouteInfo of the CountryInfo and sum them up in the way you like:
This fragment of C# code will give you a list of driving times, distances, ... per NC in all the countries that are passed:Information about distance and time per network class.
Additionally the cost field of the RouteInfo object holds the toll distance. Please note that these distances may differ in some countries (e.g. Germany) from perTypeTollDistance as they are based on the routing calculation and not on the official distance tables provided by the government, which are not available per network class.
Code: Select all
ExtendedRoute extRoute = svcRoute.calculateExtendedRoute(lstWPD.ToArray(), null, null, rlo, cio, null);
RouteInfo[] arrRouteInfo = new RouteInfo[8];
for (int i = 0; i < 8; i++)
{
arrRouteInfo[i] = new RouteInfo();
foreach (CountryInfo ci in extRoute.wrappedCountryInfos)
{
RouteInfo curRouteInfo = ci.wrappedPerNCRouteInfo[i];
arrRouteInfo[i].cost += curRouteInfo.cost;
arrRouteInfo[i].distance += curRouteInfo.distance;
arrRouteInfo[i].hasViolations = arrRouteInfo[i].hasViolations || curRouteInfo.hasViolations;
arrRouteInfo[i].hasViolationsSpecified = arrRouteInfo[i].hasViolationsSpecified && curRouteInfo.hasViolationsSpecified;
arrRouteInfo[i].time += curRouteInfo.time;
}
}
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...
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...
Re: XRoute - determine distance for different kind of roads
Hello Bernd,
much thanks for your reply
Best Regards,
Fabian
much thanks for your reply
Best Regards,
Fabian
Re: XRoute - determine distance for different kind of roads
Hello there,
i played a bit and it's working fine so far
But there are the network classes 0 - 7 only, I guess it's mapped like that:
//0 - Autobahn
//1 - ?
//2 - Bundesstraße
//3 - ?
//4 - Kreisstraße
//5 - Innerorts
//6 - ?
//7 - ?
Is there any documentation about which class means what? (at least for Germany)
The documentation doesn't really help: http://xserver.ptvgroup.com/fileadmin/f ... _Class.htm
Thanks in advance!
BR,
Fabian
i played a bit and it's working fine so far
But there are the network classes 0 - 7 only, I guess it's mapped like that:
//0 - Autobahn
//1 - ?
//2 - Bundesstraße
//3 - ?
//4 - Kreisstraße
//5 - Innerorts
//6 - ?
//7 - ?
Is there any documentation about which class means what? (at least for Germany)
The documentation doesn't really help: http://xserver.ptvgroup.com/fileadmin/f ... _Class.htm
Thanks in advance!
BR,
Fabian
- Bernd Welter
- Site Admin
- Posts: 2695
- Joined: Mon Apr 14, 2014 10:28 am
- Contact:
Re: XRoute - determine distance for different kind of roads
Helo Fabian,
maybe this thread helps - I simply looked for Autobahn:
https://xserver.ptvgroup.com/forum/view ... bahn#p1195
Best regards,
Bernd
maybe this thread helps - I simply looked for Autobahn:
https://xserver.ptvgroup.com/forum/view ... bahn#p1195
Best regards,
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...
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...
Re: XRoute - determine distance for different kind of roads
Hello Bernd,
thanks for your quick answer, I can work with that.
Best Regards,
Fabian
thanks for your quick answer, I can work with that.
Best Regards,
Fabian