Why not ask your question on the new OpenStreetMap Community Forum?

Hey, is it possible to pull out a .osm file from a postgres database. ive got osm data inputted inside a postgresql datbase on my linux server, is it now possible to pull that data out into an osm file Thanks in advance :)

asked 27 Jan '21, 13:02

shafi-as's gravatar image

accept rate: 0%

If you have imported with osm2pgsql or imposm then the answer is no, you can never go back to the original OSM file because metadata has been lost. You could possibly write code to generate a "pseudo" OpenSteetMap XML but how you would do that, and how useful it would be, depends on the data structure in your PostgreSQL and on what you want to do with the resulting OSM file.

permanent link

answered 27 Jan '21, 13:52

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 23%


i have imported using osmosis API DB would it be possible with that

(27 Jan '21, 14:07) shafi-as
(27 Jan '21, 14:21) SK53 ♦

Thanks Frederik for the insight, Also SK53 solution has allowed me to create an osm file from an API DB, for anyone who is looking for a command

sudo osmosis --read-apidb-current host="localhost" database="openstreetmap" user="xxxx" password="xxx" validateSchemaVersion="no" --write-pbf file="file path of where you want it saved and the file type /home/export.osm.pbf"

(28 Jan '21, 09:40) shafi-as
Your answer
toggle preview

Follow this question

By Email:

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



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:


question asked: 27 Jan '21, 13:02

question was seen: 1,052 times

last updated: 28 Jan '21, 09:40

powered by OSQA