NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I would like to import an .osm file into the postgresql database. I used this code to start import:

osm2pgsql -M -d postgres -S "/usr/share/osm2pgsql/default.style" -U "postgres" -W -H "localhost" -P 5432 "/home/szg_osm_db.osm"

I have no errors or cleaning ups, but when I open it in QuantumGis from postgresql database the geometry has faults. I dont know why. roads locate in wrong place, polygons are on each others. Is it projection problem? QuantumGis shows WGS84 Mercator EPGS:3395 projection. (I saved a test area from JOSM. It doesnt contain too much value. Its 2MB file.)

faults: quantumgis printsceen

I could not recognize this coordinates which QGIS shows.Thanks

PS: sorry for my bad english

asked 29 Sep '13, 11:14

lockdown90's gravatar image

lockdown90
1112
accept rate: 0%

edited 29 Sep '13, 11:36


I remember seeing something similar when using an old version of osm2pgsql that didn't support 64 bit ids. Can you run

osm2pgsql --version

and verify that it reports "64bit id space"

permanent link

answered 30 Sep '13, 03:22

Dymo12's gravatar image

Dymo12
79611016
accept rate: 12%

1

Wasn't there a 64-bit issue with QGIS itself, as described here:

http://wiki.openstreetmap.org/wiki/QGIS_OSM_Plugin

(30 Sep '13, 08:59) SomeoneElse ♦
2

The 64bit issue should be fixed in the newly released QGIS 2.0

But I have not verified that. Is anyone able to try it and report?

(30 Sep '13, 16:35) stephan75

Like Dymo12 I think this is an osm2pgsql 64-bit problem, rather than anything to do with QGIS.

(30 Sep '13, 17:58) SK53 ♦

The coordinates that QGis shows are Mercator meters, just like you requested by adding "-M" to the osm2pgsql command line. Use "-l" (small letter L) instead if you want latitude/longitude values.

The reason why some geometries are broken is likely that you saved your file from JOSM and some relations will be incomplete. This can break polygons (but not usually lines). A more thorough analysis might be possible if you placed your .osm file somewhere for us to inspect!

permanent link

answered 29 Sep '13, 12:26

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

I downloaded the map of Malta from the official site: geofabrik

I used this command that you suggested:

osm2pgsql -l -d GIStest -S "/usr/share/osm2pgsql/default.style" -U "postgres" -W -H "localhost" -P 5432 "/home/malta.osm"

and the result is also same like above. BUT the coordinates changed. screenshot

osm_roads and osm_line originated from one point.

(29 Sep '13, 16:44) lockdown90

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×263

question asked: 29 Sep '13, 11:14

question was seen: 4,112 times

last updated: 30 Sep '13, 17:58

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum