+Bambography Posted June 4, 2007 Posted June 4, 2007 I'm trying to write myself a webpage for a travel bug that shows distance to a target cache. So, due to extreme laziness I wondered if anyone has a script for calculating the distance between 2 lat/long coordinate that they don't mind sharing to save me trying myself. Thanks in advance for any help! Quote
+scottpa100 Posted June 4, 2007 Posted June 4, 2007 Would you be able to build upon work done here and here where people are freely making their PHP LAT LONG code available? May help you from having to recreate the wheel so to speak! Quote
Edgemaster Posted June 4, 2007 Posted June 4, 2007 (edited) I have googled around before for a library, I can't remember exactly where I got it from, but I have the source on my site. Library Example usage There may also be a pear lib, but I can't remember. Edit: I forgot to add, LordElph's opensourced geograph project has php classes too. It used to be on sourceforge, but they moved the project off there. (I'll add his JS version is also excellent, and underpins my OS mapping script) Edited June 4, 2007 by Edgemaster Quote
+lordelph Posted June 5, 2007 Posted June 5, 2007 Geograph's PHP conversion code on SourceForge probably hasn't changed much, it's in conversions.class.php conversionslatlong.class.php The javascript version can be found here Quote
+Bambography Posted June 5, 2007 Author Posted June 5, 2007 Cheers for these suggestions, I take a look when I get a proper chance! Thanks! Quote
+Team Sieni Posted June 6, 2007 Posted June 6, 2007 I wrote some VBA stuff that works fine based on the info given here Quote
+Bambography Posted October 18, 2007 Author Posted October 18, 2007 i've just been having a look at this and am now confused. I've added scripts suggested and also one that i've converted from Java on THIS SITE to my site. My page is http://www.bambography.co.uk/geocaching/distance.php When I use the same coords on my page and on the movable type page I get different distances. I have to admit that I don't fully understand this so there is probably something i'm missing. Does anyone know what, or am I doing something wrong? Cheers in advance! Chris. Quote
+Delta68 Posted October 19, 2007 Posted October 19, 2007 Not php, but here's a javascript one I've used on occasions Might be of use to you/someone... Quote
+Bambography Posted October 19, 2007 Author Posted October 19, 2007 Thats the one i've been trying to convert. When I add the coords to that page it gives a difference answer to my php version of the same script...?!? Quote
The Royles Posted October 19, 2007 Posted October 19, 2007 Thats the one i've been trying to convert. When I add the coords to that page it gives a difference answer to my php version of the same script...?!? Tried your script in NuSphere PhpED, and got the same answer as the other site. This suggests that your function is not getting the values you think it is getting. Quote
The Royles Posted October 19, 2007 Posted October 19, 2007 (edited) Stupid forum - double posting Edited October 19, 2007 by The Royles Quote
Edgemaster Posted October 19, 2007 Posted October 19, 2007 (edited) I listed a few classes earlier, I've since restructured my site, fixed urls are: classes and usage example. Knock an s off the extension to see the actual pages. Disclaimer: I've not done much accuracy testing for this, I didn't write it and am not using it properly yet. Edit: I've also added LordElph's geograph conversion to the example page, to compare the results. It would seem that 18km is a good result for these coords. Edited October 20, 2007 by Edgemaster Quote
+Bambography Posted October 20, 2007 Author Posted October 20, 2007 Cheers folks, i'm off for a week so will take a look when I get back! Thanks Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.