[postgis-users] Decoding canonical text of geometry(POINT) data

Mike Toews mwtoews at gmail.com
Tue Jul 1 13:36:51 PDT 2014


You will generally need to look into the EWKB implementation, which is
best documented here[1], and BNF docs here[2].
https://github.com/postgis/postgis/blob/2.1.0/doc/ZMSgeoms.txt

Also, a really readable Python implementation for WKB was written by
Lars Butler [3].

-Mike

[1] http://trac.osgeo.org/postgis/browser/trunk/doc/ZMSgeoms.txt
[2] http://trac.osgeo.org/postgis/browser/trunk/doc/bnf-wkb.txt
[3] https://github.com/larsbutler/geomet/blob/master/geomet/wkb.py

On 2 July 2014 00:30, Dmitry Dzhus <dima at dzhus.org> wrote:
> I have a database table with a `geometry(POINT, 4326)` column.
>
> I need to decode its canonical text representation in the form of
>
> 0101000020E61000008B20297D7CBF5440B2A19BFD81834B40
>
> into its components 82.9919732, 55.0274045 *without* calling PostGIS
> functions like `st_x` and `st_y` (this is a limitation of the codebase
> I'm working with -- canonical text is all I have).
> Could someone point me to any docs about the encoding details so
> that I could reimplement it?


More information about the postgis-users mailing list