Opened 12 years ago

Closed 12 years ago

#4827 closed defect (fixed)

python OGR bindings - crash on ExportToKML()

Reported by: darkblueb Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

create a geometry without a name attribute. geom.ExportToKML() will throw an exception

geom_wkt = 'MULTIPOLYGON( ((0 0,1 1,1 0,0 0)),((0 0,10 0, 10 10, 0 10),(1 1,1 2,2 2,2 1)) )'
geom = ogr.CreateGeometryFromWkt( geom_wkt )
geom.ExportToKml()

note that geom.ExportToJson(), others work fine

Change History (2)

comment:1 by Even Rouault, 12 years ago

Did you use ExportToKml() ? If so, the exception is expected due to a case issue (Kml vs KML). The following works :

>>> geom.ExportToKML()
'<MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates>0,0 1,1 1,0 0
,0</coordinates></LinearRing></outerBoundaryIs></Polygon><Polygon><outerBoundary
Is><LinearRing><coordinates>0,0 10,0 10,10 0,10</coordinates></LinearRing></oute
rBoundaryIs><innerBoundaryIs><LinearRing><coordinates>1,1 1,2 2,2 2,1</coordinat
es></LinearRing></innerBoundaryIs></Polygon></MultiGeometry>'

comment:2 by darkblueb, 12 years ago

Resolution: fixed
Status: newclosed

ok, yes I did.. The case is a little confusing, that ExportToGML() and ExportToKML() are upper case, and ExportToJson() is mixed, but I see what you mean now..

Note: See TracTickets for help on using tickets.