Hello everyone,

I'm currently trying to perform a historical analysis on OSM data. At the moment I have extracted my study areas from the full history dump using the bounding box command in Osmosis. Second to this, I have used osm2pgsql to input my data into a postgresql database (using the Postgres app). However, I can find no option that would allow me to enter the timestamp as well. Supposedly, there was once a command "--extra-attributes" that would allow user_id and timestamp (and a few other variables) to be input into the database along with the remaining data. However, this no longer works.

Is there ANY way I can get my timestamps into my database? Either with Osmosis, Osm2pgsql or another software I am unfamiliar with?

All the best,

S

asked 25 Jul '13, 10:27

SophieKS's gravatar image

SophieKS
26112
accept rate: 0%


If --extra-attributes really doesn't work then please submit a bug report here:

https://github.com/openstreetmap/osm2pgsql

Also, you should be able to retrieve an earlier version of osm2pgsql from that repository where --extra-attributes still worked.

Note that this will greatly blow up your storage requirements. 5.9.119.141 A potential workaround for the problem is writing a small tool that reads an OSM file, takes the time stamp of an object, and inserts it as a tag. I.e. if there's a

<node id="1" timestamp="something" lat="1" lon="2" user="fred" user_id="3" changeset="4" />

in the input, it creates

<node id="1" timestamp="something" lat="1" lon="2" user="fred" user_id="3" changeset="4">
<tag k="timestamp" v="something" />
</node>

That would be easy to do in most scripting languages that have an XML parser. Here's an Osmium based C++ solution: https://github.com/woodpeck/osmium_based_utils/blob/master/add_timestamp.cpp

permanent link

answered 25 Jul '13, 11:02

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
73.9k866671145
accept rate: 24%

edited 30 Jul '13, 18:48

Frederik,

As far as this post states... http://www.mail-archive.com/dev@openstreetmap.org/msg19527.html... someone has already created a ticket about the bug.

Thanks for your comments. It's a great help.

S.

(25 Jul '13, 12:10) SophieKS

If the problem is the PBF parser (as implied in that message), then why don't you convert to .osm XML with Osmosis and import that: osmosis --read-pbf my.file.osm.pbf --write-xml - | osm2pgsql ...

(25 Jul '13, 13:14) Frederik Ramm ♦

I have tried using .osh file. Do you think converting from an .osh to .osm would make any difference?

S.

(25 Jul '13, 13:28) SophieKS
1

I am surprised that an .osh file would even work given that it contains multiple versions of each object. What is your desired outcome? osm2pgsql will certainly not import more than one version of each object into the database - likely the latest. I would have thought it would just abort due to the same object being there twice. Having said that, yes, .osh is XML and would use the XML parser.

(25 Jul '13, 15:16) Frederik Ramm ♦
Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

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:

×100
×25
×16

question asked: 25 Jul '13, 10:27

question was seen: 3,570 times

last updated: 30 Jul '13, 18:48

powered by OSQA