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

Relations in Complete: best effort strategy. #63

Closed
tkubec opened this issue Sep 25, 2018 · 2 comments
Closed

Relations in Complete: best effort strategy. #63

tkubec opened this issue Sep 25, 2018 · 2 comments
Assignees
Milestone

Comments

@tkubec
Copy link

tkubec commented Sep 25, 2018

Hi!
Say, I need to get country boundaries. So, I tried:

var filtered = from osmGeo in source where osmGeo.Type == OsmSharp.OsmGeoType.Node || osmGeo.Type == OsmSharp.OsmGeoType.Way || (osmGeo.Type == OsmSharp.OsmGeoType.Relation && osmGeo.Tags != null && osmGeo.Tags.Contains("admin_level", "2") && osmGeo.Tags.Contains("type", "boundary")) select osmGeo;

Now, the result contains nodes, ways and relations (3 in case of Andorra),

But when I attempt to make complete objects, relations vanish:

var completeRelations = filtered.ToComplete().Where(x => x.Type == OsmSharp.OsmGeoType.Relation).ToList();
returns an empty results. The Ways seem to be processed well, btw, but relations are gone.

Any idea, why?
Thanks a lot

Tomas.

@xivk
Copy link
Contributor

xivk commented Nov 19, 2018

It's possible not all the members of the relation are actually in the source stream. And the members of any relation that is a member also needs to be there.

Reconstructing relations, especially boundaries from extracts is very tricky and will fail a lot of the time because not all data will be there.

OsmSharp perhaps should have an option to construct complete object with a best-effort strategy, include any objects that can be found, so returning something instead of nothing.

@xivk xivk changed the title Relations in Complete Relations in Complete: best effort strategy. Aug 6, 2019
@xivk xivk self-assigned this Aug 6, 2019
@xivk xivk added this to the Version 7 milestone Aug 6, 2019
Crul added a commit to Crul/cdda_osm_maps that referenced this issue May 2, 2021
@xivk
Copy link
Contributor

xivk commented May 10, 2021

This is now implemented. b220659

@xivk xivk closed this as completed May 10, 2021
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