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 use OpenStreetMap in order to generate maps and add some cool stuff in it. Actually I have good results but I seem to have a problem with reporting a good image ratio when I create my generated file.

I put OpenStreetMap data in a PostgreSQL and I use PostGis to work with it in the EPSG:4326 projection. Everything is fine except this ratio problem.

Actually I've tried almost every things (except the good one indeed)... that's why I'm looking for your help. I think I forgot something.

In my program I use the min lon & min lat (as origin of the selection) ans max lon & max lat (as selection max coordinates)... basically I though a correct ratio would have been given by something like that (using N as size factor):

N = 10000
x_size = maxlon - minlon
y_size = maxlat - minlat
file_width = x_size * N
file_height = y_size * N

The most intriguing part is that this computation works for some parts of the world. In my examples below, the three cities use this ratio computation, but even if Montreal and Lyon don't work, Stockholm seems to work pretty well... The two others seem stretched.

Lyon ( http://www.openstreetmap.org/?lat=45.7731&lon=4.8544&zoom=14&layers=M ): enter image description here

Stockholm ( http://www.openstreetmap.org/?lat=59.3278&lon=18.0616&zoom=14&layers=M ): enter image description here

Montreal ( http://www.openstreetmap.org/?lat=45.5088&lon=-73.5878&zoom=13&layers=M ): enter image description here

I think it's a noob problem... something silly enough to be barly invisible after hours of work on it. So I think you will find my problem easily.

Thank you.

share|improve this question
add comment

1 Answer

up vote 10 down vote accepted

Degrees of longitude get smaller as you move away from the equator, eventually going to 0 at the poles; degrees of latitude don't suffer the same fate (looking at the latitude and longitude lines on a globe will make this clearer).

Projecting your data to a coordinate system should solve the problem, because feet and meters don't change in size as you move north and south.

share|improve this answer
1  
so what you say is it's only luck if my map of Stockholm looks right? :) Thank you for your answer, but I don't understand the second part of it :( do you know where I can find some examples on the Internet? Thank you very much. –  Rootosaurus Aug 25 '11 at 7:42
    
I think you talk about 900913... am I right? –  Rootosaurus Aug 25 '11 at 13:21
    
900913 = Google projection (look at the resemblance in number and name) –  Mapperz Aug 25 '11 at 13:36
    
@Mapperz Yeah, yeah... but it seems that 900913 uses a coordinate system based on meters... no? –  Rootosaurus Aug 25 '11 at 15:18
    
@mattwigway thank you very much it works perfectly using 900913 projection. –  Rootosaurus Aug 25 '11 at 19:16
show 1 more 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.