Hi,
Does anyone know of a php library for handling map coordinates?
I'm trying to calculate the bearing to a coordinate2 (with a longitude and latitude in degrees) given coordinate1. Then I would like to calculate a third coordinate 'n' km from coordinate 1 on that bearing.
If anyone can point me to php source code or a library that might simplify things, I would greatly appreciate it.
Thanks in advance,
Phil
bearing and coordinate calculations
Moderator: General Moderators
Re: bearing and coordinate calculations
Great circle only does distances, not bearings, and Vincenty is much more accurate.
Re: bearing and coordinate calculations
Would arc-tangent get the job done?
Re: bearing and coordinate calculations
Yes.. or strictly speaking atan2 in coding. It's arctan with extras.
This page will give you all the code you need.. you'll just need to port it from Javascript into PHP: http://www.movable-type.co.uk/scripts/latlong.html
This page will give you all the code you need.. you'll just need to port it from Javascript into PHP: http://www.movable-type.co.uk/scripts/latlong.html
Re: bearing and coordinate calculations
Thanks for the moveable type link. it is just what I need. I note that it uses a three part modulus function. The mod function in php appears tO have just two arguments. Does anyone know how to replicate this method in php? If not, I'll develop a method and post it here.
Best,
phil
Best,
phil