0

I'm using ArcGISRuntime 100.0 with Qt (linux) and I'm looking for helper classes that provide conversions between DMS / DD and possible toScreenCoords etc. Do these exist ? thanks.

Gav_at_HRSTS
  • 179
  • 2
  • 11

1 Answers1

0

Use the CoordinateFormatter class - https://developers.arcgis.com/qt/latest/cpp/api-reference/esri-arcgisruntime-coordinateformatter.html

For example, here is how you could take in a lat/long string and convert it to a few formats:

// Convert Lat Long Coordinates as String to Point
Point pt = CoordinateFormatter::fromLatitudeLongitude(inputString, 
SpatialReference(4326));

// Convert Point to various String formats
qDebug() << CoordinateFormatter::toLatitudeLongitude(pt, LatitudeLongitudeFormat::DecimalDegrees, 5);

qDebug() << CoordinateFormatter::toLatitudeLongitude(pt, LatitudeLongitudeFormat::DegreesDecimalMinutes, 5);

qDebug() << CoordinateFormatter::toLatitudeLongitude(pt, LatitudeLongitudeFormat::DegreesMinutesSeconds, 5);

Here is a sample that showcases how to use it https://github.com/Esri/arcgis-runtime-samples-qt/tree/master/ArcGISRuntimeSDKQt_CppSamples/Geometry/FormatCoordinates

  • Thanks for the suggestion, but sadly the class 'CoordinateFormatter' was introduced in 100.2 and I'm currently using 100.0 of ArcGISRuntime. I toyed with the idea of upgrading to 100.3 to get access to the most current libraries however this turned out be less than a trivial exercise upgrading from 100.0 to 100.3. Esri made many breaking API changes that are documented to some extent on their website. At this point in time I've written basic conversions myself. – Gav_at_HRSTS Sep 10 '18 at 15:59