Page 1 of 1

XRoute - determine distance for different kind of roads

Posted: Fri Mar 09, 2018 12:34 pm
by huellif
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

Re: XRoute - determine distance for different kind of roads

Posted: Mon Mar 12, 2018 8:35 am
by Bernd Welter
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:
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.
This fragment of C# code will give you a list of driving times, distances, ... per NC in all the countries that are passed:

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;
    }
}
Sample output of a route from Gothenburg (Sweden) to Karlsruhe (Germany) via Hamburg (Germany)
Sample output of a route from Gothenburg (Sweden) to Karlsruhe (Germany) via Hamburg (Germany)
SummedNC.PNG (7.22 KiB) Viewed 5903 times
Best regards,
Bernd

Re: XRoute - determine distance for different kind of roads

Posted: Wed Mar 14, 2018 7:22 am
by huellif
Hello Bernd,

much thanks for your reply :)

Best Regards,
Fabian

Re: XRoute - determine distance for different kind of roads

Posted: Wed Apr 11, 2018 9:04 am
by huellif
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

Re: XRoute - determine distance for different kind of roads

Posted: Wed Apr 11, 2018 5:00 pm
by Bernd Welter
Helo Fabian,

maybe this thread helps - I simply looked for Autobahn:
https://xserver.ptvgroup.com/forum/view ... bahn#p1195

Best regards,
Bernd

Re: XRoute - determine distance for different kind of roads

Posted: Wed Apr 11, 2018 6:37 pm
by huellif
Hello Bernd,

thanks for your quick answer, I can work with that.

Best Regards,
Fabian