OpenStreetMap Forum

The Free Wiki World Map

You are not logged in.

#1 2013-02-03 20:05:44

Problem with osm2pgsql (changing coordinates)

Hi all,

I am working with JOSM to draw some buildings (inside) and also the footway that the person would have to take in order to go to any room, is for a GPS application. I am also converting the information with the comand osm2pgsql.... to have the information then in PhpPgAdmin so I can see all the points in a data base. The problem is that the coordinates in JOSM change when I import those to the PhpPgAdmin, and I don't know why, the correct information is in JOSM, and the others are wrong. I think the problem is with the command: osm2pgsql, because the PhPpgAdmin I think is not going to change anything. Any suggestions? I guess this is not the first time someone had this error but I couldn't find the answer anywhere. Thank you very much in advance.

Offline

#2 2013-04-03 17:50:20

Re: Problem with osm2pgsql (changing coordinates)

Hi again,

I couldn't find the solution yet. Do you know if there is any other tool in order to convert the data from OSM to SQL? I don't know why this is happening, because the first time I did it, it works find, but now everything change, and the coordinates don't match at all. Please if there is someone that knows anything that could help it would be the best, thank you very much.

Offline

#3 2013-04-03 18:27:43

Re: Problem with osm2pgsql (changing coordinates)

W need more details, I think.

Tell us all commands how you are converting and imoprting the data. Where is your data from before? What versions og osm2pgsql and other programs are you using?

In what kind do the coordinates differ in detail? can you give us a short example?

Offline

#4 2013-04-04 00:19:22

Re: Problem with osm2pgsql (changing coordinates)

Hi,

I am using Ubuntu 12.04.2, and I install osm2pgsql for  Ubuntu 10.04 (Lucid) or better, I think is version  0.81. I have my .osm that I modified by my own adding more points to draw the inside of a building. When I want to convert the data what I just do is:

osm2pgsql -d gis -U gisuser --slim -m myosm.osm

When I go to my phpPgAdmin to see the database I can see that the coordinates on this last one are not the right ones.
I render the .osm with mapnik 2.1 also, but I don't think that would affect tho the coordinates, rigth?

For example, one of the points with I am working is in position 51.7090171, 8.7678678 and that point when I put that comand in my phpPgAdmin takes different coordinates: 67.47682040, 9.76034580. So from Germany it moves to the middle of the Norwegian Sea, and every point is moved to that part of the planet.

I hope this is enough information, if there is anything more that should be added please tell. Thank you very much.

Offline

#5 2013-04-21 12:26:49

Re: Problem with osm2pgsql (changing coordinates)

Hi everyone again,

I found the solution ( I thought ) for the coordinates problem, it was just that the coordinates were in the default osm2pgsql system (spherical) and with just putting -l in the osm2pgsql, I could see in the database them correctly. Now the problem is that when I use the -l command my generate_image.py or tiles create an empty image, but when I don't put it the image is correctly created. Do you know why is this problem happening? thank you very much to all.

Offline

#6 2013-04-25 17:19:53

Re: Problem with osm2pgsql (changing coordinates)

As you have correctly observed, osm2pgsql stores projected coordinates in the database. By default this is spherical mercator, but you can set any arbitrary projection supported by proj4. -l basically stores unprojected coordinates in lat/lon format.

The application using the data, has to bet set to expect the coordinates in the form they are stored in the db. As the default for osm2pgsql is spherical mercator, the default of generate_image (or better to say the default style sheet) assumes the data is in spharical mercator. Thus, if they are not, things get rendered very strangely or not at all. You can specify that the data is in a different projection in the the style sheet. This is set in inc/settings.xm.inc with the osm2pgsql_projection parameter. Rendering is somewhat slower though, if you have to reproject all coordinates on the fly during rendering.

Offline

Board footer

Powered by FluxBB
Hosting sponsored by Oxilion
Report abuse to osm at na1400 dot info