[Osm4j] I can't correctly read a file in pbf format.
Manuel Enrique Puebla Martinez
mpuebla at uci.cu
Thu Nov 28 15:15:57 UTC 2019
Hi:
Please... I can't correctly read a file in pbf format. I've been doing this for days and I can't solve the problem. This is my code:
1) java.nio.file.Path input2 = Paths.get("E:\\2019-11-17-cuba-latest.osm.pbf");
2) File file= new File(input2.toUri());
3) InputStream fis = new FileInputStream(file);
4) InputStream bis = new BufferedInputStream(fis);
5) iterator = OsmIoUtils.setupOsmIterator(bis, FileFormat.PBF, true ,true);
6) InMemoryMapDataSet data = MapDataSetLoader.read(iterator, true, true,true);
However, when you run line 5, the variable "iterator" is empty, see the screenshot attached to this email.
I also reviewed the code on this page:
https://github.com/topobyte/osm4j-utils/blob/master/cli/src/main/java/de/topobyte/osm4j/utils/executables/OsmCount.java
But in that code they use this: "OsmIterator iterator = createIterator();", I couldn't find what they do in "createIterator".
With the XML format everything works great for me, but with the pbf I can't do it, however I need it, due to the large size of the geographical area I'm working with.
Greetings, Manuel Puebla.
1519-2019: Aniversario 500 de la Villa de San Cristóbal de La Habana
Por La Habana, lo más grande. #Habana500 #UCIxHabana500
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Iterator.png
Type: image/png
Size: 117871 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/osm4j/attachments/20191128/4816068e/attachment-0001.png>
More information about the Osm4j
mailing list