Select to view content in your preferred language

EsriRuntimeQt::Route::totalKilometers() returns miles, not kilometers?

2962
7
Jump to solution
10-07-2015 04:09 AM
JakobGaardsted
New Contributor III

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);

  }


					
				
			
			
				
			
			
				
0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

Hi Jakob,

Yes, this appears to be a bug. Miles looks correct but Kilometers does not. If possible, can you please contact Esri Support to get it logged, so that there is a public facing bug that you can keep track of?

As you mentioned, the workaround in the meantime is to calculate the geodesic length from the polyline on the route, and use that instead.

Thanks,

Luke

View solution in original post

7 Replies
LucasDanzinger
Esri Frequent Contributor

Hi Jakob,

Yes, this appears to be a bug. Miles looks correct but Kilometers does not. If possible, can you please contact Esri Support to get it logged, so that there is a public facing bug that you can keep track of?

As you mentioned, the workaround in the meantime is to calculate the geodesic length from the polyline on the route, and use that instead.

Thanks,

Luke

JakobGaardsted
New Contributor III

Thank you for your verification!

I tried looking at how to submit a bug report.

I am in Europe, so I got lost at http_://support.esri.com/en/ ,

whose bewildering array of options mainly seem to apply to US customers and 'international distributors',

so I ended up sending an email with the bug description to my national ESRI distributor's support-email.

Thank you.

LucasDanzinger
Esri Frequent Contributor

Perfect, they will be able to submit a bug to Esri support on your behalf.

Thanks,

Luke

JakobGaardsted
New Contributor III

Followup - this is now a registered bug as

[BUG-000091356 - Qt Runtime displays miles rather than kilometers for the EsriRuntimeQt::Route::totalKilometers() method.]

cheers, Jakob.

Hishoshr
New Contributor

Greetings,

iam newer in arcgis developer , iam using qt for develops , can give me a simple code about how to get distance & time in routing

Thank you in advance

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Hisho-

A good place to start is to download the sample viewer and check out the routing samples.

QML samples - ArcGIS for Developers | ArcGIS for Developers

C++ samples - ArcGIS for Developers | ArcGIS for Developers

Use the samples as a base, and then consult the API reference for finer grain details.

Thanks,

Luke

0 Kudos
Hishoshr
New Contributor

Thank you

0 Kudos