[postgis-devel] Into the Soup

Paragon Corporation lr at pcorp.us
Wed Dec 15 14:57:01 PST 2010


Paul,
The first thing you'll do is remove the functions AsText and Length so you
can't use them anymore in examples, right? Remmber ST_Everything was your
idea.

Or is there a reason to keep these things around?

Thanks,
Regina 

-----Original Message-----
From: postgis-devel-bounces at postgis.refractions.net
[mailto:postgis-devel-bounces at postgis.refractions.net] On Behalf Of Paul
Ramsey
Sent: Wednesday, December 15, 2010 5:25 PM
To: PostGIS Development Discussion
Subject: [postgis-devel] Into the Soup

You'll noticed that in the last couple commits, this fun little block of
code appeared:

http://trac.osgeo.org/postgis/browser/trunk/postgis/lwgeom_pg.h#L71

All those previous commits removing SERIALIZED_LWGEOM and various appears to
memcpy have been attempts to cleanse the code base of direct appeals to the
underlying serialization, and while not complete, a large swathe of the code
base is now clean, so much so that I can now define PG_LWGEOM to be
GSERIALIZED and have things sort of magically work...

postgis20=# select astext('POINT(0 0)'::geometry);
   astext
------------
 POINT(0 0)
(1 row)

postgis20=# select length('LINESTRING(0 0, 1 1)'::geometry);
     length
-----------------
 1.4142135623731
(1 row)

postgis20=# select st_relate('LINESTRING(0 0, 1 1)', 'POINT(0.5 0.5)');
st_relate
-----------
 0F1FF0FF2
(1 row)

In the examples above, the LWGEOM_in function is converting the text to a
GSERIALIZED, which is passed to the next function and then output as WKT and
length checked and GEOS operated on. Magical.

This trick is pretty cool, but there are still come functions that appeal
directly to serialization that need to be fix, and most importantly the
index bindings need to be swapped over to use the bindings in geography. It
will be interesting to see if that can also be done conditionally.

Paul
_______________________________________________
postgis-devel mailing list
postgis-devel at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-devel





More information about the postgis-devel mailing list