Opened 10 years ago

Closed 6 years ago

#2405 closed enhancement (fixed)

osm2pgsql: patch to include extrainfo (username, uid, version)

Reported by: rullzer Owned by: jburgess777@…
Priority: minor Milestone:
Component: osm2pgsql Version:
Keywords: osm2pgsql Cc:

Description

I wanted to do some rendering which included user information (who touched this way the latest etc). But in order to do that I needed to modify osm2pgsql to include this data in the database. Attached is a patch (svn diff) to get the desired result.

Since it is a flag it does not affect people that do not want this. So I think it is ready to go into the code :) But feel free of course to first check my changes :)

Attachments (3)

osm2pgsql_userinfo.patch (21.8 KB) - added by rullzer 10 years ago.
patch to include userdata in the postgis tabels
osm2pgsql_extrainfo.patch (3.9 KB) - added by rullzer 10 years ago.
Now with the use of tags
osm2pgsql_extrainfo.2.patch (4.5 KB) - added by rullzer 10 years ago.
Now also include timestamp

Download all attachments as: .zip

Change History (15)

Changed 10 years ago by rullzer

Attachment: osm2pgsql_userinfo.patch added

patch to include userdata in the postgis tabels

comment:1 Changed 10 years ago by Ldp

Owner: changed from Tom Hughes to jburgess777@…

comment:2 Changed 10 years ago by rullzer

Summary: osm2pgsql: patch to include user infoosm2pgsql: patch to include extrainfo (username, uid, version)

Added a new patch. This now also includes version information which is also a nice thing if you want to visualize activity etc.

comment:3 Changed 10 years ago by jburgess777@…

It looks like a good new feature. I was wondering if you had considered the approach of turning the user/uid/version information into tags when reading the objects? This might be an easier way to pass the data through the existing code with less changes. Then user/uid/version can be added to the style to obtain the relevant columns in the DB.

comment:4 Changed 10 years ago by rullzer

very true! Then it would not require an extra flag and the user can even choose to include this only for nodes for example.

I'll start working on a new patch :)

Changed 10 years ago by rullzer

Attachment: osm2pgsql_extrainfo.patch added

Now with the use of tags

comment:5 Changed 10 years ago by rullzer

New patch attached. Does the same thing but now with the use of tags.

I named the field: osm_user, osm_uid and osm_version. This since it is unlikely they will be used but version=* is far more likely.

Changed 10 years ago by rullzer

Attachment: osm2pgsql_extrainfo.2.patch added

Now also include timestamp

comment:6 Changed 10 years ago by rullzer

New patch to also include the timestamp. Simply add the following lines to your default.style file

node,way osm_user text linear node,way osm_uid int linear node,way osm_version int linear node,way osm_timestamp timestamp linear

And enjoy the new features. I used native types since they take less space and are faster to query than strings.

comment:7 Changed 10 years ago by jonb

Resolution: fixed
Status: newclosed

(In [19144]) Allow user,uid,version & timestamp attributes to be imported from osm objects. Fixes #2405.

comment:8 Changed 10 years ago by jburgess777@…

I finally got around to adding this feature into osm2pgsql. In the end I thought it was better to make this extra information optional since it does increase the storage required to hold all the objects.

Thanks for your patches & patience!

comment:9 Changed 10 years ago by Ldp

Resolution: fixed
Status: closedreopened

One issue with the current way this is implemented: this new feature injects the osm_* tags into the tag list for each object. Because of this, suddenly *every* way/node is interesting enough to be included in the resulting db.

I could do with an intermediate way as well: do inject these extra attributes, but don't consider them important enough on their own to merit adding the object to the db. This way we do get the extra attributes for stuff that would render, but not the extra stuff that wouldn't render anyway.

comment:10 in reply to:  9 Changed 10 years ago by jburgess777@…

Replying to Ldp:

One issue with the current way this is implemented: this new feature injects the osm_* tags into the tag list for each object. Because of this, suddenly *every* way/node is interesting enough to be included in the resulting db.

I forgot about this. It sounds like we need to another flag for this kind of inconsequential data. How about 'minor'?

This will indicate that the data is included if present but will not in itself cause the object to get an entry into the DB. I can imagine that we could mark several other tags as minor since that make no sense to appear on their own, e.g. access, width etc.

comment:11 Changed 8 years ago by Tom Hughes

Component: utilsosm2pgsql

comment:12 Changed 6 years ago by amm

Resolution: fixed
Status: reopenedclosed

Closing, as the main points of the bug report have been implemented, and there hasn't been any activity in 4 years.

Note: See TracTickets for help on using tickets.