At present, osm2pgsql seems to ignore the timestamp and user id of the elements, a serious drawback for some applications. According to a bug report this is not solved by the addition of the --extra-attributes tag. I've just tested this in osm2pgsql 0.83.0 and am wondering if there is a good way around it?

My plan B is to do pre-filtering with osmosis and then load the data into R using osmar. Still, it would be nice to have the PostGIS option working also.


The default.style file has this annotation:

There are some special database columns that if present in the .style file will be populated by osm2pgsql. These are

osm_user, osm_uid, osm_version, osm_timestamp - datatype text. Used with the --extra-attributes option to include metadata in the database. If importing with both --hstore and --extra-attributes the meta-data will end up in the tags hstore column regardless of the style file.

I have not tested it myself, but adding those tags in the style file and ommitting --hstore should work. --extra-attributes is not enough.

| improve this answer | |
  • It sounds like adding the --hstore tag should work, but when I type: osm2pgsql --hstore --extra-attributes -d Cycway GB_cycleways.pbf , it results in an error: failed: ERROR: type "hstore" does not exist – RobinLovelace Mar 13 '14 at 15:06
  • But without --hstore and with the following lines added, it works: 147 node,way osm_user text linear 148 node,way osm_uid text linear 149 node,way osm_timestamp text linear The final command was thus: osm2pgsql --extra-attributes -S default.style -d Cycway GB_cycleways.pbf – RobinLovelace Mar 13 '14 at 15:27
  • The --hstore option requires to run share\contrib\hstore.sql once when setting up the database. But the metadata will then only be in the hstore column. – AndreJ Mar 13 '14 at 15:36

Maybe a heavy solution/workaround for a smal problem, but you can try to work with full planet extracts: http://wiki.openstreetmap.org/wiki/Planet.osm/full

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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