postgis/lwgeom
Sandro Santilli 06f6125337 Added early return from force_collection when input is already a collection
AND has a bbox cache. Suggested by Ron Majer.


git-svn-id: http://svn.osgeo.org/postgis/trunk@1444 b70326c6-7e19-0410-871a-916f4a2858ee
2005-02-25 09:31:54 +00:00
..
.cvsignore generalized library ignore line 2004-09-20 08:53:06 +00:00
BBOXCACHE_BEHAVIOURS Fixed GeometryFromText() to add a bbox cache FOR_COMPLEX_GEOMS 2005-02-23 09:58:16 +00:00
box2d.c Initial revision 2004-10-08 13:15:26 +00:00
compat.h Added a copy of GNU vsprintf.c file and compiled in. 2004-11-02 16:48:54 +00:00
liblwgeom.c Replaced DEBUG* macros with PGIS_DEBUG*, to avoid clashes with postgresql DEBUG 2005-02-07 13:21:10 +00:00
liblwgeom.h Added comment on top of TYPE macros 2005-02-25 08:57:50 +00:00
lwcollection.c Changed 'char' to 'uchar' (unsigned char typedef) wherever octet is actually 2005-02-10 10:52:53 +00:00
lwgeom.c Changed byte to uchar to avoid clashes with win32 headers. 2005-02-21 16:16:14 +00:00
lwgeom.h makeline_from_multipoint() implemented and exposed. 2004-10-15 16:21:33 +00:00
lwgeom_api.c Fixed a bug in pointArray_construct() copying input points instead 2005-02-17 09:19:20 +00:00
lwgeom_box.c Big layout change. 2004-09-29 10:50:30 +00:00
lwgeom_box2dfloat4.c Dropped getbox2d_internal(). 2005-02-10 17:41:55 +00:00
lwgeom_box3d.c Replaced DEBUG* macros with PGIS_DEBUG*, to avoid clashes with postgresql DEBUG 2005-02-07 13:21:10 +00:00
lwgeom_btree.c Replaced DEBUG* macros with PGIS_DEBUG*, to avoid clashes with postgresql DEBUG 2005-02-07 13:21:10 +00:00
lwgeom_chip.c Changed 'char' to 'uchar' (unsigned char typedef) wherever octet is actually 2005-02-10 10:52:53 +00:00
lwgeom_debug.c Replaced DEBUG* macros with PGIS_DEBUG*, to avoid clashes with postgresql DEBUG 2005-02-07 13:21:10 +00:00
lwgeom_dump.c Replaced DEBUG* macros with PGIS_DEBUG*, to avoid clashes with postgresql DEBUG 2005-02-07 13:21:10 +00:00
lwgeom_estimate.c Changed min() max() usage with LW_MIN() LW_MAX() 2005-02-21 16:22:32 +00:00
lwgeom_functions_analytic.c Syntaxes cleanups. 2005-02-17 15:54:01 +00:00
lwgeom_functions_basic.c Added early return from force_collection when input is already a collection 2005-02-25 09:31:54 +00:00
lwgeom_geos.c Early release of DETOASTED geoms. 2005-02-22 10:10:13 +00:00
lwgeom_geos_wrapper.cpp Syntaxes cleanups. 2005-02-17 15:54:01 +00:00
lwgeom_gist.c Replaced DEBUG* macros with PGIS_DEBUG*, to avoid clashes with postgresql DEBUG 2005-02-07 13:21:10 +00:00
lwgeom_gml.c Dropped getbox2d_internal(). 2005-02-10 17:41:55 +00:00
lwgeom_inout.c Added missing prototype 2005-02-24 08:36:35 +00:00
lwgeom_ogc.c Fixed bug in StartPoint and EndPoint functions. 2005-02-24 08:32:08 +00:00
lwgeom_pg.c Replaced DEBUG* macros with PGIS_DEBUG*, to avoid clashes with postgresql DEBUG 2005-02-07 13:21:10 +00:00
lwgeom_pg.h Added new indexable operators <<|, &<|, |&> and |>> to allow comparisons of bounding box positions in the Y axis 2005-01-11 14:20:41 +00:00
lwgeom_spheroid.c Dropped getbox2d_internal(). 2005-02-10 17:41:55 +00:00
lwgeom_svg.c Dropped getbox2d_internal(). 2005-02-10 17:41:55 +00:00
lwgeom_transform.c Dropped getbox2d_internal(). 2005-02-10 17:41:55 +00:00
lwgeom_triggers.c Added cache_bbox trigger 2004-12-30 10:24:25 +00:00
lwgparse.c Changed byte to uchar to avoid clashes with win32 headers. 2005-02-21 16:16:14 +00:00
lwline.c Dropped getbox2d_internal(). 2005-02-10 17:41:55 +00:00
lwmline.c Changed 'char' to 'uchar' (unsigned char typedef) wherever octet is actually 2005-02-10 10:52:53 +00:00
lwmpoint.c Changed 'char' to 'uchar' (unsigned char typedef) wherever octet is actually 2005-02-10 10:52:53 +00:00
lwmpoly.c Changed 'char' to 'uchar' (unsigned char typedef) wherever octet is actually 2005-02-10 10:52:53 +00:00
lwpoint.c Dropped getbox2d_internal(). 2005-02-10 17:41:55 +00:00
lwpoly.c Changed 'char' to 'uchar' (unsigned char typedef) wherever octet is actually 2005-02-10 10:52:53 +00:00
lwpostgis.sql.in Added bool::text cast. 2005-02-23 09:00:36 +00:00
Makefile lib version changed to 1.0.0RC3, scripts version to 0.2.0. 2005-02-24 08:10:21 +00:00
measures.c Fixed some introduced misorderings of func declaration/body. 2005-02-17 15:39:17 +00:00
MISSING_OBJECTS updated 2004-11-11 09:42:26 +00:00
pgsql_compat.h Moved pgsql compatibility code into pgsql_compat.h 2005-01-07 11:50:49 +00:00
profile.h Debugging defines set to NODEBUG. 2004-09-27 08:26:03 +00:00
ptarray.c Dropped getbox2d_internal(). 2005-02-10 17:41:55 +00:00
README Added updated README file 2005-01-13 09:10:11 +00:00
stringBuffer.c header inclusion cleanup 2004-10-28 16:28:07 +00:00
stringBuffer.h Added a cstring(lwgeom) function that returns WKT! 2004-04-07 23:12:31 +00:00
test.c Added simpler lwpoint constructors. 2004-10-13 14:26:36 +00:00
TODO updated 2005-01-18 10:09:21 +00:00
vsprintf.c Added a copy of GNU vsprintf.c file and compiled in. 2004-11-02 16:48:54 +00:00
wktparse.h Changed byte to uchar to avoid clashes with win32 headers. 2005-02-21 16:16:14 +00:00
wktparse.lex Added missing prototypes 2005-01-10 09:47:14 +00:00
wktparse.y Reintroduced support for '<anygeom> EMPTY' form, for OGC compliance. 2005-01-18 13:31:54 +00:00
wktunparse.c Changed byte to uchar to avoid clashes with win32 headers. 2005-02-21 16:16:14 +00:00

Welcome to the Initial version of LWGEOM.

More information is available on the PostGIS user's mailing list and 
the PostGIS developer's mailing list.  

Differences
-----------

The LWGEOM is very much like the original PostGIS GEOMETRY type.  The 
main differences are:

a) LWGEOMs are much smaller than the PostGIS GEOMETRY
b) LWGEOMs natively support 2d, 3d, and 4d points
c) LWGEOMs are indexed using single-precision bounding boxes.  This
   make the indexes significantly smaller than PostGIS GEOMETRY
   indexes.
d) LWGEOMs are internally very similar to OGC WKB   
e) The "normal" view of LWGEOMs is OGC WKB - PostGIS GEOMETRY is OGC WKT
f) PostGIS geometries have a built-in BOX3D.  LWGEOMs have an *optional*
   BOX2D (see below).


Also included with the LWGEOMs is a type called 'box2d'.  This is
very similar to PostGIS BOX3D type:

a) BOX2Ds are 2D - BOX3D is 3D
b) BOX2Ds are represented by single-precision floating point numbers,
   while BOX3Ds are double-precision floating point numbers.
c) BOX2Ds will sometimes be slightly larger than you might expect.
   This is because the conversion from double-precision to 
   single-precision is inexact.  When this happens, the BOX2D will
   automatically expand itself.
   

Bounding Boxes
--------------

<this section for advanced users.  Ignore it if you don't understand
 what its saying.>

Bounding boxes are optional in LWGEOMs.  By not having one, you are
saving a small amount of space per LWGEOM geometry (16 bytes).

Bounding boxes are attached to any non-POINT geometry by default.

You can disable this automatic addition setting AUTOCACHE_BBOX to 0
in the top-builddir Makefile.config and read BBOXCACHE_BEHAVIOURS
for function-by-function behaviour explanation.

Manual control of bbox cache is available using DropBBOX() and AddBBOX().

UPDATE <table> SET <geomcol> = DropBBOX(<geomcol>);
UPDATE <table> SET <geomcol> = AddBBOX(<geomcol>);

Note that if you don't cache a BBOX spatial operators will be much slower,
as they'll need to compute all the boxes at every invokation.
If you use GiST indexes you will still note a slow down as a RECHECK
clause is specified for GiST operators. Also, GiST index updating
will be slower w/out a BBOX cache.


Space Saving
------------

LWGEOM indexes are approximately 40% smaller than PostGIS indexes.

A LWGEOM 'POINT(0 0)' takes up 21 bytes, a POSTGIS 'POINT(0 0)' takes
up 140 bytes.  This shows that LWGEOMs have a much smaller overhead.

LWGEOMs will store 2D points as 2 double precision numbers (16 bytes) -
PostGIS will store 2D points with 3 numbers (24 bytes).   This can be 
another big savings.