Opened 17 years ago

Closed 17 years ago

#1888 closed defect (fixed)

ExportToJson GeometryCollection handling

Reported by: crschmidt Owned by: hobu
Priority: normal Milestone: 1.5.0
Component: PythonBindings Version: unspecified
Severity: normal Keywords:
Cc: warmadam

Description (last modified by hobu)

   if self.GetGeometryType() == ogr.wkbGeometryCollection or \
       self.GetGeometryType() == ogr.wkbGeometryCollection25D:
        geometries = []    
        geom_count = geometry.GetGeometryCount()
        for g in range(geom_count):
            geom = self.GetGeometryRef(g)
            geometries.append(geom.ExportToJson())
        output = {'type': types[self.GetGeometryType()],
                  'geometries': geometries}
    else:
        output = {'type': types[geometry.GetGeometryType()],
                  'coordinates': get_coordinates(geometry)}

Attachments (1)

better_exporttojson.patch (2.4 KB ) - added by crschmidt 17 years ago.
fixes copy paste errors

Download all attachments as: .zip

Change History (6)

comment:1 by crschmidt, 17 years ago

Needs a \ after the or.

comment:2 by hobu, 17 years ago

Resolution: fixed
Status: newclosed

Added in r12333

comment:3 by hobu, 17 years ago

Description: modified (diff)
Milestone: 1.5.0

by crschmidt, 17 years ago

Attachment: better_exporttojson.patch added

fixes copy paste errors

comment:4 by crschmidt, 17 years ago

Resolution: fixed
Status: closedreopened

The code I pasted was cargo culted from an external ogrhelpers module -- not written internally. This patch is against the actual ogr code, and is tested to after a 'python setup.py install' from trunk plus this patch.

comment:5 by hobu, 17 years ago

Resolution: fixed
Status: reopenedclosed

I think we're done with this after r12335.

Note: See TracTickets for help on using tickets.