5

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.

In my program I use the min lon & min lat (as origin of the selection) ans max lon & max lat (as selection max coordinates). I thought 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

1 Answer 1

11

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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