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

Martijn Meijers b.m.meijers at tudelft.nl
Tue Jul 1 05:38:45 PDT 2014


On 07/01/2014 02:30 PM, Dmitry Dzhus 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?

It's hexadecimal form of Well Known Binary (see  "Simple Features 
Specification for SQL", and may be enriched with some specifics for 
postgis, such as srid).

For a parsing implementation in Python see e.g.

http://www.fabianowski.eu/projects/ppygis/


Martijn

-- 
Martijn Meijers

mailto:b.m.meijers at tudelft.nl
http://www.gdmc.nl/martijn

GIS-technology
Faculty of Architecture and the Built Environment
Delft University of Technology



More information about the postgis-users mailing list