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'm using the following command to import an osm file into a Postgres DB using Linux:

osm2pgsql -v -a -U user -S default.style -d routing myfile.osm

I got the following error:

Setting up table: planet_osm_point Problem reading geometry information for table planet_osm_point - does it exist? Error occured, cleaning up

I guess I have to manually create the schemas into db.

Can osm2pgsql be used to automatically create such schemas? Otherwise, how can I create them?

share|improve this question
add comment

3 Answers 3

up vote 4 down vote accepted

You have to set up the database in the form osm2pgsql expects it. I have written a detailed Howto here (you might use google to translate):

http://wiki.openstreetmap.org/wiki/User:Ajoessen/Postgis
share|improve this answer
    
thanks for the link. Unfortunately I'm using Linux, and the Howto seems not to cover it. I'll edit the question to specify that. –  Heisenbug Nov 16 '12 at 15:20
1  
This page might help you with Linux: wiki.openstreetmap.org/wiki/Mapnik/PostGIS –  Andre Joost Nov 16 '12 at 15:41
add comment

The commands are the same as the commands listed in the answer provided by @Andre Joost except you shouldn't need to provide the full path, all those commands should be in your normal path.

The one exception would be if you're using PostGIS 2.0 or later. In that case you can use the extension manager to create the postgis and postgis_topology extensions.

share|improve this answer
add comment

Just add a "--create" flag to osm2pgsql.

share|improve this answer
add 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.