How to get Latitude, Longitude values from cells

Best practices, code snippets for common functionality, examples, and guidelines.
Elena_v
Posts: 18
Joined: Tue Jun 25, 2019 4:27 pm

How to get Latitude, Longitude values from cells

Post by Elena_v » Mon Dec 13, 2021 11:52 am

I have a table in my App and Latitude, Longitude values in degrees °"' in cells (for example, 28°22"02,874'), but Ranorex Spy in Cell.Text give me "0,495105666665712" instead of "28°22"02,874'". It seems in radian. But I need actual value ("28°22"02,874'"). How to get values from cells in degrees °"'?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7469
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to get Latitude, Longitude values from cells

Post by odklizec » Mon Dec 13, 2021 2:08 pm

Hi,

I'm afraid, that without seeing, at very least, a Ranorex snapshot (NOT screenshot) of the app under test, there is not much anyone here can do or suggest.

If there is no converted value found anywhere in the Spy, then you will most probably have to ask developers of the app, what kind of value is this and how to convert it (via code) to desired format. There is definitely no automatic way or Ranorex function, which will do it for you.

I researched it a bit and the value indeed appears to be in radians (check this page). So you must convert it do degrees. Try for example this code (found here):

Code: Select all

using System;

public static double ConvertRadiansToDegrees(double radians)
{
    double degrees = (180 / Math.PI) * radians;
    return (degrees);
}
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Elena_v
Posts: 18
Joined: Tue Jun 25, 2019 4:27 pm

Re: How to get Latitude, Longitude values from cells

Post by Elena_v » Mon Dec 13, 2021 3:13 pm

It seems like a "peculiarity" of my app.
I had 1 day to think and have decided to not reinvent the wheel))) Radians - ok, will validate radians!