[gdal-dev] Python problem with exportToGML()

Eric Wolf ebwolf at gmail.com
Tue Feb 16 23:01:24 EST 2010


I've decided to just get some work done rather than focus on the Oracle
issues. Fortunately, the code I write with OGR using Shapefiles should work
seamlessly with Oracle (or relatively seamlessly).

But now I have a new problem. I am getting the following error when I call
exportToGML():

Traceback (most recent call last):
  File "shp2n3.py", line 178, in <module>
    write_triples()
  File "shp2n3.py", line 137, in write_triples
    gml = geom.exportToGML()
  File "C:\Python26\lib\site-packages\osgeo\ogr.py", line 2672, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, Geometry, name)
  File "C:\Python26\lib\site-packages\osgeo\ogr.py", line 34, in
_swig_getattr
    raise AttributeError,name
AttributeError: exportToGML

The bit of code looks like

geom = feat.GetGeometryRef()
 if geom is not None:
gml = geom.exportToGML()
 outs = '      :hasGML ' + gml + '^^gmlr:string '

outs += ".\n"
outFp.write(outs)
else:
print "Can't get geometry!"
print "GDAL Error: " + gdal.GetLastErrorMsg()

geom is not None. I get the same results with Python 2.5.5.7 + GDAL 1.5.2
and Python 2.6.4.10 + GDAL 1.6.1.

-Eric

-=--=---=----=----=---=--=-=--=---=----=---=--=-=-
Eric B. Wolf                    New! 720-334-7734
USGS Geographer
Center of Excellence in GIScience
PhD Student
CU-Boulder - Geography

GPG Public Key: http://www.h4h.net/ebwolf.public.key.txt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100216/0a027231/attachment.html


More information about the gdal-dev mailing list