I want a method to export osm files from a postgress database. I already have a osm2pgsql database, a apidb database and nominatim database in which I have imported osm files. Now I need to export osm files from a database with a osm2pgsql schema and use with the nominatim and api-db(openstreetmap-website) database.

I know that the osm2pgsql is a tool for populating a PostGIS database that allow we run the Mapnik rendering software, Nominatim search software, or our own geospatial queries and have a totally different database table structure to that required by the openstreetmap-website rails app.

But, I need to create for use in future imports using osmosis and osm2pgsql tools and for backup purposes.

Can anyone help me how to do this?

  • It looks like you have at least three questions embedded in this one. As per the Tour there should be only one question per question so I think you should research/ask about how "to import a current osm file to PostgreSQL" first. – PolyGeo Dec 23 '15 at 19:47

There is no way to export a osm file from a database with osm2pgsql schema.

So I solved my problem creating a database with the snapshot schema that is a modified and simplified version of the main OSM DB schema.

I imported my osm file and redid the changes that I had made in the database with the osm2pgsql schema in the database with the snapshot schema.

Now, I can import a osm file with osmosis of the database with snapshot using the command:

osmosis --read-pgsql host="" database="" user="" password="" outPipe.0=pg --dd inPipe.0=pg outPipe.0=dd --write-xml inPipe.0=dd file=file.osm 

and I used this osm file to generate my databases with for my databases with nominatim, osm2pgsql and APIDB schema.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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