Closed Alexey-Stolyarov closed 9 years ago
At moment default behaviour is that you should call Initialize() before reading from the source. But I will leave this issue open because what could change is:
The source is also an IEnumerable
@xivk, code below is failing when I execute it. I used Initialize() method. In XmlOsmStreamSource there is no such issue.
[Test]
public void Test()
{
using (var fileStream = File.OpenRead(@"d:\osm\oberbayern-latest.osm.pbf"))
{
using (var reader = new PBFOsmStreamSource(fileStream))
{
reader.Initialize();
var counter = 0;
while (reader.MoveNextWay())
{
if (counter++%10000==0)
{
Debug.Print(counter.ToString());
}
}
}
}
}
Might be this issue with incomplete ways intersecting the bounding box of the pbf and missing nodes,remember? Tom
@APLANA-Alexey-Stolyarov Thanks for reporting this, OsmSharp just got a little bit better thanks to you! :+1:
@TomQv This issue is a bit different as here we are not trying to assemble ways with al their nodes just processing the raw data.
It fails when using MoveNextWay(), but work ok with MoveNext().
at OsmSharp.Osm.PBF.Dense.Decompressor.ProcessPrimitiveBlock(PrimitiveBlock block, Boolean ignoreNodes, Boolean ignoreWays, Boolean ignoreRelations) at OsmSharp.Osm.PBF.Streams.PBFOsmStreamSource.MoveToNextPrimitive(Boolean ignoreNodes, Boolean ignoreWays, Boolean ignoreRelations) at OsmSharp.Osm.PBF.Streams.PBFOsmStreamSource.MoveNext(Boolean ignoreNodes, Boolean ignoreWays, Boolean ignoreRelations) at OsmSharp.Osm.Streams.OsmStreamSource.MoveNextWay() at ...
Tested on http://download.geofabrik.de/europe/germany/bayern/oberbayern-latest.osm.pbf