Given the lat/lon of 2 close points on earth (<10m), How do I calculate the distance in metres?
I have the lat/lon of 2 points on the earth. They are really close together, <10m. Let's assume the earth is flat. How do I calculate the distance between them in metres?
I know about tools (PostGIS, etc.) that can do this correctly, however I'm just doing a rough and ready type, and I'm 开发者_如何学COK with low accuracy. At such small sizes a difference of 1% is only 10cm, which is fine for me. I'm doing this in stock python. I'm OK with a standard Euclidean distance thing.
For such low precision take a look at the pythagorean formulas in article on earth distance.
But, also read some explanations here (for example if the coordinates are not already in Cartesian coordinates it might be computationally cheaper to use Haversine formula).
I'd recommend using the Haversine Formula. Here's a Javascript implementation I've referenced before: http://www.movable-type.co.uk/scripts/latlong.html.
Get plane lengths for degrees lat and long from a site like this and, as you suggest, calculate the distances in cartesian coordinates. For distances as small as 10m the inaccuracies in your calculations will be lost in the least significant digits of the results.
精彩评论