I try to read in an .osm-file with python and GDAL/OGR, and then I want to save way IDs and associated node coordinates in a dictionary. For some strange reason, OGR seems to skip either entire ways or some nodes of a way.
I get different results when using an ordinary XML-Parser to read in the file - no ways or nodes of ways are skipped.
Code used with OGR:
count = 0 for wayFeature in layer2: processWay(wayFeature) # do smthg with the feature count=count+1
Code used with ElementTree to parse xml:
for way in root.findall('way'): id = way.get('id') processWay(way) #do smthg with the way count = count+1
With ogr,I get 253 ways, with the XMLParser, I get 794 - a huge difference. 794 is what I expect,as I did a find&count on my .osm file.
How can that be?
I already set the osmconf.ini file to not ignore any nodes or ways,no matter if they have relevant tags or not.
Does it maybe have to do with the way's IDs in the file? I already played around with a dummy file, OGR sometimes seems skip ways where ID's are not ascending...but not always.
I could use the XML parser, but OGR has some nice features like filters and intersection tests, which I would like to use.