Advanced

Update to distance callbacks

Update to distance callbacks
November 26, 2021 11:13AM
The documentation for the distance callbacks (DistanceVincenty and DistanceHaversine) used to say that the script had to handle nil values for latitude longitude, which will happen with premium only geocaches for non premium users.

However, latitude and longitude is in that case FALSE and not NIL. I have corrected the documentation (with the coming release). I have also added so that the distance functions will return FALSE when getting the wrong input. This will probably crash most scripts since they usually try to add the distance to something, and the variable types won't match.

This QA article made me find the issue: https://project-gc.com/qa/?qa=27716/problem-with-geo-checker
It uses this script, which had correctly implemented a way to avoid NIL, I added FALSE as well, which fixes the issue: https://project-gc.com/Challenges/GC8D8M8/44955

So if you see new kinds of crashes on scripts using distance functions this is probably why. The script then needs to handle missing coordinates correctly. Formerly, I assume false,false as a coordinate was translated into 0,0 in PHP, which caused quite long distances.
Sorry, you do not have permission to post/reply in this forum.