PostGIS 3.6.2dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ lwgeom_needs_bbox()

int lwgeom_needs_bbox ( const LWGEOM geom)
extern

Check whether or not a lwgeom is big enough to warrant a bounding box.

Check whether or not a lwgeom is big enough to warrant a bounding box when stored in the serialized form on disk. Currently only points are considered small enough to not require a bounding box, because the index operations can generate a large number of box-retrieval operations when scanning keys.

Definition at line 1271 of file lwgeom.c.

1272{
1273 assert(geom);
1274 if ( geom->type == POINTTYPE )
1275 {
1276 return LW_FALSE;
1277 }
1278 else if ( geom->type == LINETYPE )
1279 {
1280 if ( lwgeom_count_vertices(geom) <= 2 )
1281 return LW_FALSE;
1282 else
1283 return LW_TRUE;
1284 }
1285 else if ( geom->type == MULTIPOINTTYPE )
1286 {
1287 if ( ((LWCOLLECTION*)geom)->ngeoms == 1 )
1288 return LW_FALSE;
1289 else
1290 return LW_TRUE;
1291 }
1292 else if ( geom->type == MULTILINETYPE )
1293 {
1294 if ( ((LWCOLLECTION*)geom)->ngeoms == 1 && lwgeom_count_vertices(geom) <= 2 )
1295 return LW_FALSE;
1296 else
1297 return LW_TRUE;
1298 }
1299 else
1300 {
1301 return LW_TRUE;
1302 }
1303}
#define LW_FALSE
Definition liblwgeom.h:94
#define MULTILINETYPE
Definition liblwgeom.h:106
#define LINETYPE
Definition liblwgeom.h:103
#define MULTIPOINTTYPE
Definition liblwgeom.h:105
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:102
#define LW_TRUE
Return types for functions with status returns.
Definition liblwgeom.h:93
uint32_t lwgeom_count_vertices(const LWGEOM *geom)
Count points in an LWGEOM.
Definition lwgeom.c:1309
uint8_t type
Definition liblwgeom.h:462

References LINETYPE, LW_FALSE, LW_TRUE, lwgeom_count_vertices(), MULTILINETYPE, MULTIPOINTTYPE, POINTTYPE, and LWGEOM::type.

Referenced by GEOS2POSTGIS(), gserialized1_from_lwgeom(), gserialized2_from_lwgeom(), lwgeom_from_gserialized1(), lwgeom_from_gserialized2(), LWGEOM_in(), LWGEOM_recv(), LWGEOMFromEWKB(), and LWGEOMFromTWKB().

Here is the call graph for this function:
Here is the caller graph for this function: