Decimal Degree coordinates in Double format

177
2
Jump to solution
10-28-2019 11:31 PM
ChrisPalmer2
New Contributor

Hello!

This question is about the SDK for Qt using C++

In my prototype application (c++), I instantiate a map with:

m_map = new Map(BasemapType::ImageryWithLabels, [SOME_DOUBLE], [SOME_NEGATIVE_DOUBLE], 18, this);

and everything looks great. When I later do a conversion from screen coordinate (via mouse click) to real-world coordinate using something like this (where 'event' is a QMouseEvent):

Esri::ArcGISRuntime::Point point = m_mapView->screenToLocation(event.x(), event.y());

auto latLong = Esri::ArcGISRuntime::CoordinateFormatter::toLatitudeLongitude(
    point,
    Esri::ArcGISRuntime::LatitudeLongitudeFormat::DecimalDegrees,
    4);

 

I end up with some wild numbers. in the latLong.x and latLong.y values.

If I then use:

CoordinateFormatter::toLatitudeLongitude(point, LatitudeLongitudeFormat::DecimalDegrees, 4)

to convert it to text, I end up with N,S,E,W notations on the end. Is there a way that I can simply get the coordinates in decimal degrees as doubles? 

0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

There isn't an option for that currently. You could do some QString manipulation and split at the space, remove the last character of each resulting string, and add a - if S or W

View solution in original post

2 Replies
LucasDanzinger
Esri Frequent Contributor

There isn't an option for that currently. You could do some QString manipulation and split at the space, remove the last character of each resulting string, and add a - if S or W

View solution in original post

ChrisPalmer2
New Contributor

That's what I ended up doing. Thank you for the answer!

0 Kudos