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 |
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
in the input, it creates
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 answered 25 Jul '13, 11:02 Frederik Ramm ♦ 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 ♦
|