[postgis-devel] Updates to GEOS & POSTGIS

Ben Jubb benjubb at refractions.net
Thu Jan 17 17:07:43 PST 2008


Hi all,
I've checked in some changes to GEOS & PostGIS,  All changes are in the 
pursuit of getting prepared geometry (from JTS 1.9) into PostGIS.

First in GEOS:
exposed the prepared geometry objects in the CAPI, bumping the version 
of CAPI to 1.5.0.
fixed a few small problems in the GEOS code.

Then in PostGIS:
Added new functions to lwgeom_geos_c.c to support prepared geometry 
predicates. 
bool containsPrepared( geom, geom)
bool containsProperlyPrepared( geom, geom)
bool coversPrepared( geom, geom)
bool intersectsPrepared( geom, geom)

These functions require a caching mechanism to retain some state between 
calls.  All of these functions work the same way.  The first argument is 
checked every time to see if its been seen before.  If so, the geometry 
argument is prepared and cached, if it hasn't been already.  Subsequent 
calls to these predicate functions with the same first argument will use 
the cached prepared geometry to do the test, potentially saving a lot of 
time.

These functions only show improvements when the first (or both) 
argument(s) is(are) fairly large objects (>1000 points or so).  The 
caching overhead wipes out any gains with smaller objects.

The functions are exposed to PostgreSQL via these wrappers:
ST_ContainsPrepared( geometry, geometry )
ST_ContainsProperlyPrepared( geometry, geometry )
ST_CoversPrepared( geometry, geometry )
ST_IntersectsPrepared( geometry, geometry )

as well, this function was added, for orthogonality:
ST_ContainsProperly( geometry, geometry )


Hopefully somebody has a big polygon and thousands of geometries to test 
against that polygon.  This should make things happen a bit quicker. 
Hopefully alot quicker.

cheers
b

-------------- next part --------------
A non-text attachment was scrubbed...
Name: benjubb.vcf
Type: text/x-vcard
Size: 255 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20080117/5e0e5016/attachment.vcf>


More information about the postgis-devel mailing list