Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using/learning geodjango + postgis, and I'm trying to calculate distance between 2 cities in Poland. First using WGS84/4326 I define 2 points, and then after transforming this points into spherical mercator 900913 i get distance which is about 40km too long. Which map projection should I use then? Where can I find proper srid's for different countries?

Arek

share|improve this question
    
do you have the latitude and longitude values so we can check? –  mhoran_psprep Mar 19 '12 at 1:52
    
sorry for the delay, 2 cities (lat; long): Slupsk(54.465249;17.026062) and Koszalin(54.193378;16.179428) –  agend Mar 24 '12 at 17:24
add comment

3 Answers

up vote 1 down vote accepted

That's what picking a decent map projection is all about. I don't know your lat/long range but you can query projections relevant to a lat/long bounding box at the EPSG Geodetic Parameter Dataset. This should give some codes to test out.

EDIT: Thanks for posting your coordinates. When you just calculate a cartesian distance between these points in a Plate Carree or something similar projection, you get something like 90km which is obviously the wrong result from a wrong method.

Others have explained the 'math route' using a spherical calculation, so I took the 'tool route' and retrieved the ETRS89 projection from the EPSG database based on your coordinates, measuring in this coordinate system I get about 63km, which is the considerable difference we're seeing.

enter image description here

share|improve this answer
    
thank you - would u mind explaining me how to find the proper projection for my coordinates on epsg.org page - all i can see there is a bunch of links to same white papers or other thinks which i don't ever try to understand. Thanks in advance –  agend Mar 31 '12 at 7:06
    
epsg-registry.org is actually the more direct link and will point you to a this dialog without any additional searching around. The most quick/dirty method of choosing a system would be to review the "Area Description" field and pick a ProjectedCRS system that appears to describe your geographical area most specifically (eg "Poland" vs "Europe"). You could do some quick research to see what metric is important to you to preserve in an available projection (distance, area, bearing, etc). However for pure distance, (< 1-2m), you should use one of the geodesic methods below. –  WolfOdrade Apr 2 '12 at 4:23
add comment

Use latitude and longitude and the great circle distance, not a map projection.

share|improve this answer
    
i tried to use pyproj which is python binding for proj4 library. And using 'sphere' ellipsoid i still get distance which is about thirty km too big. g = pyproj.Geod(ellps='sphere') a, b, dist = g.inv(54.186548, 16.177368, 54.465249, 17.026062) dist = 98516.645068962112 –  agend Mar 24 '12 at 17:27
    
Agend, you appear to have mixed up the latitudes and longitudes. g.inv(16.177368, 54.186548, 17.026062, 54.465249) will return 63335.3 meters, which is 35.1813 kilometers shorter--about what you're looking for. –  whuber Mar 24 '12 at 20:25
    
so now i'm getting totally lost - will have look at that - thank you –  agend Mar 31 '12 at 7:04
add comment

Based on the 2 points in your comments:

2 cities (lat; long): Slupsk(54.465249;17.026062) and Koszalin(54.193378;16.179428) 

I used two different approaches. The formula given in The Aviation Formulary I ended up with a distance of 63.116745 KM

I also used this tool Calculate distance, bearing and more between Latitude/Longitude points. I ended up with an answer of 63.16 km.

Both methods use a "cue ball" earth, they do not use WGS84, or any projection.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.