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

Center attribute missing on OSM entities #3

Open
labiang opened this issue Aug 19, 2021 · 5 comments
Open

Center attribute missing on OSM entities #3

labiang opened this issue Aug 19, 2021 · 5 comments

Comments

@labiang
Copy link

labiang commented Aug 19, 2021

The "center" attribute that sometime is received from an Overpass response is missing in the implementation of the osm4j parsers (especially XML parser).

The center attribute belongs to ways/relations and looks something like this: <center lat="46.2965728" lon="8.7908617"/>

Example of a whole tag (including center attribute):
<way id="458341945" version="2" timestamp="2021-04-26T18:48:09Z" changeset="103656292" uid="74900" user="FischersFritz"> <center lat="46.2965728" lon="8.7908617"/> <nd ref="4543689513"/> <nd ref="8669512158"/> <nd ref="8669512156"/> <nd ref="8669512155"/> <nd ref="8669512157"/> <nd ref="4543689514"/> <nd ref="8669512151"/> <nd ref="8669512149"/> <nd ref="8669512148"/> <nd ref="8669512150"/> <nd ref="4543689515"/> <nd ref="8669512146"/> <nd ref="8669512145"/> <nd ref="8669512144"/> <nd ref="8669512147"/> <nd ref="4543689516"/> <nd ref="8669512154"/> <nd ref="8669512153"/> <nd ref="8669512152"/> <nd ref="8669512159"/> <nd ref="4543689513"/> <tag k="building" v="yes"/> <tag k="castle_type" v="palace"/> <tag k="historic" v="castle"/> <tag k="name" v="Castello Marcacci"/> </way>

@sebkur
Copy link
Member

sebkur commented Aug 19, 2021

Interesting, thanks for bringing this up. I'm not sure about a good way of handling this.

@labiang
Copy link
Author

labiang commented Aug 19, 2021

@sebkur I was already able to mimic such behaviour by creating derived classes of the handlers and such from the OSM4J library...
In the SAX handler, I added the parsing of the "center" tag.

I will probably fork this project, implement this functionality and then create a pull request to add it into the main repo.

I need this functionality for something that I am working on (which works closely with OSM and Overpass).

@sebkur
Copy link
Member

sebkur commented Aug 19, 2021

my only worry is that this is a bit non-standard, i.e. the center element is not really an OSM api but something overpass-specific. If there should be more of those, it could clutter the API a bit. But not sure this is a concern we should be worried about. Does overpass also support this center element for relations? does it also support other non-standard extensions of the data types?

@sebkur
Copy link
Member

sebkur commented Aug 26, 2021

OK, I just checked, the <center> element is also present on relations

@labiang
Copy link
Author

labiang commented Sep 5, 2021

Sorry for the delayed response; Yes it is present on any type of OSM element and represents the interior point coordinates of that element.

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

No branches or pull requests

2 participants