gps distance calculation

Discussions about CSEntry
Post Reply
slwendo
Posts: 17
Joined: March 11th, 2017, 4:13 pm

gps distance calculation

Post by slwendo »

Hi

I've tried using the gps function to calculate great-circle distances between two points (as explained in the manual) but I do not get a distance if the second point is not provided using the gps() function.
LAT1, LON1, LAT2, LON2, DISTANCE are variables in my dictionary where LAT1 and LON1 come from a lookup file (pre-existing coordinates for a point).
LAT2 and LON2 are set from a succesful gps reading (see below).

LAT2 = gps(latitude);
LON3 = gps(longitude);

If DISTANCE is set with gps(distance,LAT1,LON1,LAT2,LON2) --> it returns default.
If DISTANCE is set with gps(distance,LAT1,LON1,gps(latitude),gps(longitude)) --> it returns a distance in meters.

Is this by design?

Regards,

--

Steven Lwendo
Gregory Martin
Posts: 1796
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: gps distance calculation

Post by Gregory Martin »

Based on your description, my guess is that you are executing this in the preproc of either LAT2 or LON2? If so, you have to use visualvalue for the PROC that you're on. If you're doing this in LON2, you would have to do:
gps(distance, LAT1, LON1, LAT2, visualvalue(LON2))
slwendo
Posts: 17
Joined: March 11th, 2017, 4:13 pm

Re: gps distance calculation

Post by slwendo »

Thanks Greg. I was trying to use LAT2 and LON2 at a variable before them, even though it was after I had set them.
Post Reply