Hi,
I’m trying to retrieve some data like a particular spot which are available in pbf like following :
<node id="1345278334" lat="53.3912404" lon="-1.4685589" version="1" timestamp="2011-06-30T21:27:17Z" changeset="8594226" uid="358273" user="alpha2424">
<tag k="barrier" v="block"/>
</node>
(Note : the above example is converted version of a pbf to osm)
the problem is I’m not able to see any data for Node collection but according to “osmformat.proto” <https://github.com/scrosby/OSM-binary/tree/master/src>
I should get some meaningful data back the code I’ve written
if (h.getType().equals("OSMHeader"))
{
HeaderBlock hb = HeaderBlock.parseFrom(blobData);
System.out.println("hb: " + hb.getSource());
} else if (h.getType().equals("OSMData"))
{
PrimitiveBlock pb = PrimitiveBlock.parseFrom(blobData);
System.out.println("pb: " + pb.getGranularity());
Osmformat.StringTable st = pb.getStringtable();
System.out.println("s in pb : " + st.getSCount());
List<ByteString> sts = st.getSList();
for(int l=0;l<sts.size();l++)
{
System.out.println("SB : " + sts.get(l).toString());
}
//System.out.println(pb.getPrimitivegroupCount());
List<Osmformat.PrimitiveGroup> pgs = pb.getPrimitivegroupList();
for (int i=0;i<pgs.size();i++)
{
System.out.println("ways :" + pgs.get(i).getWaysCount());
System.out.println("nodes :" + pgs.get(i).getNodesCount());
System.out.println("changes :" + pgs.get(i).getChangesetsCount());
System.out.println("relations :" + pgs.get(i).getRelationsCount());
Osmformat.DenseNodes dns = pgs.get(i).getDense();
System.out.println("denses :" + dns.getKeysValsCount());
//System.out.println(pgs.get(i).getWaysCount());
List<Osmformat.Node> nodes = pgs.get(i).getNodesList();
System.out.println(nodes.size());
}
}
could anybody here help me what is my problem ? why does my Node collection is always returing 0 to me? but after converting it to OSM I can see that some of the nodes(not all of them) has some data such as above snippet xml?