in 10.2.6, and possibly also 10.2.3, I experience that
EsriRuntimeQt::Route::totalKilometers() 'consistently' returns miles, not kilometers?
Luckily, ER::GeometryEngine::geodesicLength
seems to give the correct result, or at least the same value I can measure with Google Earth.
In fact, calling route.totalMiles() gives same value that totalKilometers() gives..?
In a way, I'm impressed with ESRI trying to reconcile the age-old difference between metric and imperial units, with this initiative.
I just suspect, that it takes someone on the scale of Napoleon to achieve change on that level.
On the positive side, route.totalMiles() seems to return a correct value, so it's about 50% correct.
I am running off these data:
https:_//route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World
http:_//services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer
I am running on msvc2013, 32bit, and based in Europe;
the example was measured in Iceland (on map).
I'm curious if it is related to something in my setup, or if any others experience similar.. Seems like a weird bug people would react to.
My queries look like this:
bool bLocal = ( !UseEsri::useOnlineRouting() ); //!NodeLinkDlg_Gis::OnlineRoutingHack);
if (bLocal) {
#ifdef HACK_10_2_3
ER::LocalRouteTaskParameters lparameters = HACK_10_2_6_STAR lroutingTask.defaultParameters();
#else // > 10.2.3:
ER::RouteTaskParameters& lparameters = HACK_10_2_6_STAR lroutingTask.defaultParameters();
#endif // HACK_10_2_3
lparameters.setOutSpatialReference(spatRef);
lparameters.setOutputLines(bWithMeasure ? ER::NAOutputLine::TrueShapeWithMeasure : ER::NAOutputLine::TrueShape);
lparameters.setReturnRoutes(true);
lparameters.setStops( HACK_10_2_6_AMP stops);
lroutingTask.solve( HACK_10_2_6_AMP lparameters);
} else { // Online:
#ifdef HACK_10_2_3 // For some reason, >10.2.3 does not allow us to check if routingtask object is correctly initialized?
if (oroutingTask.isEmpty()) { // bad path to data
QMessageBox::warning(NULL, QObject::tr("Routing Error"), QObject::tr("The oroutingTask is empty."), QMessageBox::Ok ); // this
return false;
}
#endif // HACK_10_2_3
// stops.setCompressedRequest(true);
#ifdef HACK_10_2_3
ER::OnlineRouteTaskParameters oparameters = HACK_10_2_6_STAR oroutingTask.defaultParameters();
#else // > 10.2.3:
ER::RouteTaskParameters* p_oparameters = oroutingTask.defaultParameters(); // HACK_10_2_6_STAR
if (p_oparameters == NULL) {
debstr() << "Err: oroutingTask.defaultParameters failed!\n";
QMessageBox::warning(NULL, QObject::tr("Routing Error"), QObject::tr("oroutingTask.defaultParameters failed."), QMessageBox::Ok );
return false;
}
ER::RouteTaskParameters& oparameters = *p_oparameters;
#endif // HACK_10_2_3
oparameters.setOutSpatialReference(spatRef);
oparameters.setOutputLines(bWithMeasure ? ER::NAOutputLine::TrueShapeWithMeasure : ER::NAOutputLine::TrueShape);
oparameters.setReturnRoutes(true);
oparameters.setStops( HACK_10_2_6_AMP stops);
oroutingTask.solve( HACK_10_2_6_AMP oparameters);
}