I want a method to export osm files from a Postgres database. I already have an osm2pgsql database, an apidb database, and a nominatim database in which I have imported osm files. Now I need to export osm files from a database with an osm2pgsql schema and use it with the nominatim and api-db(openstreetmap-website) database.
I know that the osm2pgsql is a tool for populating a PostGIS database that allows us to run the Mapnik rendering software, Nominatim search software, or our geospatial queries and have a 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 with 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– PolyGeo ♦2015年12月23日 19:47:50 +00:00Commented Dec 23, 2015 at 19:47
1 Answer 1
There is no way to export an 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've imported my osm file and I recreated 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
So, I used this osm file to generate my databases for my databases with nominatim, osm2pgsql, and APIDB schemas.