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 have a function that takes a point and compares it with lines that are stored in PostGIS and then gets the line closest to the point. Initially I did not transform the data because I did not think that it would matter when I want to get the minimum distance. I thought that small distances (up to 100m) would not need transformation but I was wrong! Sometimes it gets a line that is not the closest one even if the compared distances are 1.2m and 2.5m. I discovered that and I re-designed the SQL command to transform the point and line to the local UTM zone and now its working fine.

I would appreciate it if someone could explain to me how is this possible at such a small scale. Why did PostGIS think that a line 2.5m away from my point is closer than a line 1.2m away? Perhaps an emphasis on UNITS vs metric unit usage?

Thank you for your time and effort! Regards, A

share|improve this question
related to: gis.stackexchange.com/questions/6822/… - performing plane geometric calculations on geographic coordinates introduces huge errors. –  underdark Nov 5 '12 at 17:12

1 Answer 1

up vote 1 down vote accepted

You'll have to put your mental visualization cap on, but remember, lines of longitude converge at the poles. So, a 5x5 square at the equator squeezes down to a narrow rectangle at the poles. Effectively, a "unit" of unprojected horizontal distance covers less and less real distance the further north you go. This is probably the source of the discrepancy you are seeing.

share|improve this answer

Your Answer


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.