Does anyone know how to read postgis wkb format  with srid ? I find no
information on the format.
With shapely I can get the geometry with SQLObject ORM

from sqlobject import *
from shapely.wkb import loads
connection_string = 'postgres://localhost:5432/gis'
connection = connectionForURI(connection_string)
class spots(SQLObject):
    _connection = connection
    _fromDatabase = True
    name = StringCol()
    geom = StringCol()
    def _get_geom(self):
        value = self._SO_get_geom()
        test = loads(value.decode('hex')).wkt
        return test

a = spots.get(1)
 a.name
'Gas Station'
a.geom
'POINT (-81.4200000000000017 37.6499999999999986)'

 But where and how is stored the srid ? I can get it with the raw
query possibility of sqlobject

spots._connection.queryOne("""SELECT AsText(geom), Srid(geom),geom
FROM spots WHERE (spots.id) = (1)""")

[('POINT(-81.42 37.65)', 4326,
'0101000020E61000007B14AE47E15A54C03333333333D34240'),]

but is not pythonic.

Reply via email to