Reputation: 4844
I have been looking for a piece of code (preferably in PHP) which can take a latitude, longitude and a plus/minus value (in Km) and return the minimum and maximum latitude and longitudes.
I can't seem to find anything which both explains what it does in simplistic terms as well as takes into account the 'bloated' curvature of the earth.
Can anyone help?
Upvotes: 0
Views: 1460
Reputation: 4844
In order to make things easier, I have switched to MongoDB's system and am currently using MongoHQ's REST API to access the data with their geo APIs.
Upvotes: 0
Reputation: 10756
This is tricky because latitude/longitude is an angular quantity, whereas your radius distance is an incompatible linear quantity.
Here are some methods of solving it, in decreasing order of accuracy and increasing order of simplicity of coding.
I recommend no. 1.
Upvotes: 1
Reputation: 95111
Not sure why why you want to do this in pure PHP but MySQL
and MongoDB
support geospatial indexing which has huge performance advantage over any pure PHP implementation.
I personal prefer the MongoDB
version because it installed by default and you can easily serach by
Please See
Upvotes: 0