Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support OSM XML metadata (timestamp, etc) #15814

Closed
2hu4u opened this issue May 9, 2024 · 3 comments
Closed

Support OSM XML metadata (timestamp, etc) #15814

2hu4u opened this issue May 9, 2024 · 3 comments

Comments

@2hu4u
Copy link

2hu4u commented May 9, 2024

I'll preface this with the warning that I am a novice at OpenLayers and js in general.
The output mode of Overpass out meta returns useful metadata for OSM data, such as timestamp at which the features were last updated.
Example for a way:

<way id="663136850" version="3" timestamp="2023-02-26T10:58:39Z" changeset="133037154" uid="11304604" user="RichieRRR">
    <nd ref="6207491506"/>
    <nd ref="6286508870"/>
    <nd ref="6286508869"/>
    <tag k="highway" v="residential"/>
    <tag k="name" v="Park Street"/>
</way>

Example for a node:

<node id="25607898" lat="-32.0055774" lon="115.8780024" version="2" timestamp="2009-05-17T08:07:16Z" changeset="1218208" uid="16558" user="tiger_old"/>

Currently the feature returned by OSM XML seems to only be able to to get the id and the tags and the lat and lon for the nodes.

Some users have previously accomplished this as an extension to a much earlier version of OpenLayers;
Extended OSM parser. Adds meta attributes as tags
It would be useful if the metadata attributes were added in an accessible way similar to how tags are.

The use case would ideally be styling of the geometry as per timestamp. Image below is in QGIS (OSM data parsed using QuickOSM plugin and then symbology Graduated by to_int(format_date(osm_timestamp,'yyyy')))
The overpass query for this was;

rel(11334807)->.suburb;
.suburb;map_to_area;
way[highway=residential](area);
(._;>;);
out meta;

QGIS simulation
The purpose being to highlight antiquated data.

@ahocevar
Copy link
Member

ahocevar commented May 9, 2024

I think it would make sense to add that metadata as a configurable metadata property for each feature. Do you think you'd be able to create a pull request?

@2hu4u
Copy link
Author

2hu4u commented May 9, 2024

Hello, I appreciate the reply. I tried for a couple hours to modify the existing osmxml.js part of ol.js.map offline to parse the timestamp with getAttribute similarly to how lat and lon are parsed, but was unable to make any headway. I think it's beyond my capabilities unfortunately.

@2hu4u
Copy link
Author

2hu4u commented May 26, 2024

The easy (and obvious) workaround to this was to simply convert it to GeoJSON using osmtogeojson which adds the metadata tags as feature properties. So it's effectively solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants