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 all, hoping someone can help with this. I have some basic code that loads a PBF file as a PBFOsmStreamSource, uses a FilterBox to reduce the size of the search area and then converts this to a FeatureSource:
FileStream fs = File.OpenRead(filename);
var source = new PBFOsmStreamSource(fs);
var s = source.FilterBox(x1, y2, x2, y1);
filtered = from osmGeo in s
where osmGeo.Type == OsmSharp.OsmGeoType.Node ||
osmGeo.Type == OsmSharp.OsmGeoType.Way
select osmGeo;
features = filtered.ToFeatureSource();
var featureList = features.ToList();
On small areas (say, about 1km), this code works fine.. but as soon as I make the FilterBox area fairly large, the last line of this code causes an exception, stating:
'Attribute id already exists!'
Any idea why this is happening? Is there some way I can filter out duplicate attribute ids?
Thanks!
Chris.
The text was updated successfully, but these errors were encountered:
at NetTopologySuite.Features.AttributesTable.Add(String attributeName, Object attributeValue)
at OsmSharp.Geo.DefaultFeatureInterpreter.TagsAndIdToAttributes(ICompleteOsmGeo osmObject)
at OsmSharp.Geo.DefaultFeatureInterpreter.Interpret(ICompleteOsmGeo osmObject)
at OsmSharp.Geo.Streams.Features.Interpreted.InterpretedFeatureStreamSource.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.ToList()
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
Looking at what DefaultFeatureInterpreter.TagsAndIdToAttributes actually does, I'm wondering if there's something amiss with the PBF, with the specific area I'm looking at... but I don't know how to filter out the problem.
Thought I would give an update on this - I was actually trying to draw in an incredibly large area - bigger than I'd realised.
I still think it should be possible, or at least the error should be trappable, but for my use-case I'd just miscalculated the size of the region, and once I got it down to what I actually wanted, the error didn't appear.
Hi all, hoping someone can help with this. I have some basic code that loads a PBF file as a PBFOsmStreamSource, uses a FilterBox to reduce the size of the search area and then converts this to a FeatureSource:
On small areas (say, about 1km), this code works fine.. but as soon as I make the FilterBox area fairly large, the last line of this code causes an exception, stating:
'Attribute id already exists!'
Any idea why this is happening? Is there some way I can filter out duplicate attribute ids?
Thanks!
Chris.
The text was updated successfully, but these errors were encountered: