[postgis-devel] Into the Soup
pramsey at opengeo.org
Wed Dec 15 14:24:54 PST 2010
You'll noticed that in the last couple commits, this fun little block
of code appeared:
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);
postgis20=# select length('LINESTRING(0 0, 1 1)'::geometry);
postgis20=# select st_relate('LINESTRING(0 0, 1 1)', 'POINT(0.5 0.5)');
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.
More information about the postgis-devel