You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
changed the title
Relations in Complete
Relations in Complete: best effort strategy.
Aug 6, 2019
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.
The text was updated successfully, but these errors were encountered: