6

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?

6

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
1

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.

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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