Opened 9 years ago

Closed 9 years ago

#5440 closed (fixed)

GEOSGeometry: Add WKB support

Reported by: Robert Coup Owned by: jbronn
Component: GIS Version: gis
Severity: Keywords: sprint
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Attached is a patch that adds WKB support to the GEOSGeometry object, which we can use for more efficient conversions/access.

Create a GEOSGeometry by passing the binary data as a buffer type (via buffer()):

# wkb = buffer('\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0?')
# geom = GEOSGeometry(wkb)
# geom.wkt
'POINT (0.0000000000000000 1.0000000000000000)'

Get the WKB out:

# geom = Point(0, 1)
# geom.wkb
<read-only buffer for 0x2b10ff1c2030, size -1, offset 0 at 0x2b10ff1a6d18>
# str(geom.wkb)
'\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0?'

In addition to tests for WKB, I've added a number of extra tests around geometry creation from formats other than WKT.

Attachments (1)

geos_wkb_support.patch (4.8 KB) - added by Robert Coup 9 years ago.

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by Robert Coup

Attachment: geos_wkb_support.patch added

comment:1 Changed 9 years ago by Adrian Holovaty

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Version: SVNgis

comment:2 Changed 9 years ago by jbronn

Owner: changed from nobody to jbronn

comment:3 Changed 9 years ago by jbronn

Status: newassigned

comment:4 Changed 9 years ago by jbronn

Resolution: fixed
Status: assignedclosed

(In [6314]) gis: Fixed #5440 with patches from rcoup; cleaned up notice handler in libgeos.

Note: See TracTickets for help on using tickets.
Back to Top