I am trying to open a *.osm file in Python with GDAL. But I doesn't work. What am I doing wrong?
import ogr
driver = ogr.GetDriverByName('OSM')
datasource = driver.Open('map.osm')
layer = datasource.GetLayer()
Error looks like this
>>>
Traceback (most recent call last):
File ".../osm_reader.py", line 3, in <module>
datasource = driver.Open('map.osm')
AttributeError: 'NoneType' object has no attribute 'Open'
I exported the data directly from the OSM Website. My Python Version is 2.7.5.
About my GDAL Version I am not sure. And this might be the problem.
Easy Install says
U:\>easy_install GDAL
Searching for GDAL
Best match: GDAL 1.10.1
Adding GDAL 1.10.1 to easy-install.pth file
Using c:\python27\lib\site-packages
GDAL Version says
>>> gdal.VersionInfo()
'1810'
Does 1810
mean GDAL 1.10.1? How do I get this to work?
ogr.Open(...)
?>>> print ogr.Open('map.osm') >>> None
. What exactly do you mean?