This is related to an old question of mine - Issues with osgeo - qgis.core and arcpy modules
Now in new versions of all the software QGIS Lisboa (1.8), ArcGIS 10.1 and pyScripter 2.5.3. They all use python 2.7
I can't get the following to work.
>>> import osgeo
>>> from osgeo import ogr
arcgis 10.1 and pyscripter fail here.
>>> import os
>>> os.chdir(r'L:\Data_Admin\QA\test_data\Boundaries\Local_Govt\TRC\TAB')
>>> driver = ogr.GetDriverByName('MapInfo File')
>>> fn='trc_boundary.tab'
>>> dataSource=driver.Open(fn,0)
>>> layer = dataSource.GetLayer(0)
>
feature = layer.GetFeature(0) extent=layer.GetExtent() extent (-12895.844282306107, 376810.87105960253, 7944810.84780738, 8222992.984638059) numFeatures=layer.GetFeatureCount() geometry = feature.GetGeometryRef() Traceback (most recent call last): File "", line 1, in AttributeError: 'NoneType' object has no attribute 'GetGeometryRef'
QGIS python shell fails here. Not sure why - I checked http://www.gdal.org/ogr/classOGRGeometryCollection.html but it is not helpful.
my
PYTHONPATH=C:\Python27\ArcGIS10.1;C:\OSGeo4W\apps\python27; C:\Program Files (x86)\Quantum GIS Lisboa
I have installed the gdal python bindings for arcgis but then where is ogr?
also I can't seem to run
from osgeo import gdal
dataset = gdal.open("c:/abc.img")
Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'open'