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

◆ lwgeom_to_basic_type()

static LWGEOM * lwgeom_to_basic_type ( LWGEOM geom,
uint8  original_type 
)
inlinestatic

In place process a collection to find a concrete geometry object and expose that as the actual object.

Will some geom be lost? Sure, but your MVT renderer couldn't draw it anyways.

Definition at line 823 of file mvt.c.

824{
825 LWGEOM *geom_out = geom;
826 if (lwgeom_get_type(geom) == COLLECTIONTYPE)
827 {
828 LWCOLLECTION *g = (LWCOLLECTION*)geom;
829 geom_out = (LWGEOM *)lwcollection_extract(g, original_type);
830 }
831
832 /* If a collection only contains 1 geometry return than instead */
833 if (lwgeom_is_collection(geom_out))
834 {
835 LWCOLLECTION *g = (LWCOLLECTION *)geom_out;
836 if (g->ngeoms == 1)
837 {
838 geom_out = g->geoms[0];
839 }
840 }
841
842 geom_out->srid = geom->srid;
843 return geom_out;
844}
#define COLLECTIONTYPE
Definition liblwgeom.h:122
LWCOLLECTION * lwcollection_extract(LWCOLLECTION *col, int type)
Takes a potentially heterogeneous collection and returns a homogeneous collection consisting only of ...
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition lwgeom.c:1079
static uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition lwinline.h:135
uint32_t ngeoms
Definition liblwgeom.h:566
LWGEOM ** geoms
Definition liblwgeom.h:561
int32_t srid
Definition liblwgeom.h:446

References COLLECTIONTYPE, LWCOLLECTION::geoms, lwcollection_extract(), lwgeom_get_type(), lwgeom_is_collection(), LWCOLLECTION::ngeoms, and LWGEOM::srid.

Referenced by mvt_clip_and_validate(), mvt_geom(), mvt_grid_and_validate_geos(), and mvt_iterate_clip_by_box_geos().

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