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

Question: adding custom tag #1

Open
alecava58 opened this issue Jan 20, 2017 · 1 comment
Open

Question: adding custom tag #1

alecava58 opened this issue Jan 20, 2017 · 1 comment

Comments

@alecava58
Copy link

Looking at IDP I'd need to add a custom tag if the nodes referenced by a way is inside an area.
My idea was to create a filter like AddWayId but I don't know how to get the coordinates of the nodes contained in the Nodes collection of the Way.

Could you help me doing this.
Thanks
static OsmSharp.OsmGeo EventsFilter_AddWayId(OsmSharp.OsmGeo osmGeo, object param) { if (osmGeo.Type == OsmSharp.OsmGeoType.Way) { var w = (OsmSharp.Way)osmGeo; foreach(var node in w.Nodes) { //var lat = ?? how to get latitude of node } osmGeo.Tags.Add("way_id", osmGeo.Id.ToString()); } return osmGeo; }

@xivk
Copy link
Contributor

xivk commented Feb 9, 2017

This is why Itinero does 2 passes over the OSM-data. This is what happens in each pass:

  1. Checks way tags and if usefull adds the node id's to a large set.
  2. Saves the node coordinates that are in the set from pass 1.

This is the only way to get all the node coordinates. Itinero already does so you should be able to reuse the way I have done this.... have a look at the code processing the OSM data in Itinero.

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