[postgis-users] Converting Geometry to WKT

Paul Ramsey pramsey at opengeo.org
Mon Dec 13 09:54:26 PST 2010


The canonical output form for PostGIS is "hex-encoded extended
well-known binary". The "hex encoded" part should be self-explanatory.
The "extended" part is explained here:

http://svn.osgeo.org/postgis/trunk/doc/ZMSgeoms.txt

And the well-known-binary part is in the OGC SFSQL. Note that we also
support extended types like circular strings, polyhedral surfaces,
etc, etc, so perusing the WKB output function might help you avoid any
unpleasantness.

http://svn.osgeo.org/postgis/trunk/liblwgeom/lwout_wkb.c

Paul


On Mon, Dec 13, 2010 at 9:41 AM, Adam Eskreis <aeskreis at gmail.com> wrote:
> Hey all,
>
> I was wondering if there was any documentation out there on how to convert
> PostGIS geometry to WKT.  The reason that I need this is I am looking to
> write a PHP library that will allow me to pull PostGIS geometry directly
> from the database (without having to use the AsText() function) and put the
> resulting geometries into PHP objects (such as a Point object, Polygon
> object, ect).  This is essential for my application.  I have written the PHP
> class already to accept WKT, but I want to take it to the next level and
> actually parse the raw geometry.  I've done a lot of searching on google and
> haven't been able to find anything similar nor could I find any
> documentation about how PostGIS stores geometry.  Can anyone who has
> undertaken this before give me a nudge in the right direction?  Thanks.
>
> -Adam
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>



More information about the postgis-users mailing list