geoalchemy/geoalchemy2 — pull request #52 by Giszmo (2013-05-25 17:18:42+00:00)
Title: Deserialization for WKB

@lweberk created issue https://github.com/geoalchemy/geoalchemy2/issues/51
and we've been working on resolving it on our end. This merge request shares our findings. It adds a property to WKBElement to access WKB as a python-native tuple.

For example on my table with a field of type Polygon, initializing the polygon with
```python
lake.geom = POLYGON((88.555555555 88.555555555,89.555555555 88.555555555,89.555555555 89.555555555,88.555555555 88.555555555))
```
(produces this well known binary:
```
b'0103000000010000000400000083f5e2388e23564083f5e2388e23564083f5e2388e63564083f5e2388e23564083f5e2388e63564083f5e2388e63564083f5e2388e23564083f5e2388e235640'
```
) and when querying lake.geom from the db I get this geom.tuple:
``` python
Polygon(wkb_id=3, rings=[LineString(wkb_id=2, points=[Point(wkb_id=1, x=88.555555555, y=88.555555555), Point(wkb_id=1, x=89.555555555, y=88.555555555), Point(wkb_id=1, x=89.555555555, y=89.555555555), Point(wkb_id=1, x=88.555555555, y=88.555555555)])])
```

A way to re-serialize the tuple exists in wkb.py but is not exposed to WKBElement yet.

This code is not ready for productive use in general geoalchemy2 applications but will most likely not get extended by us neither if there is no interest by the community, as it serves our needs as is.