PostGIS  3.2.2dev-r@@SVN_REVISION@@

◆ lwgeom_to_basic_type()

static LWGEOM* lwgeom_to_basic_type ( LWGEOM geom,
uint8_t  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 789 of file mvt.c.

790 {
791  LWGEOM *geom_out = geom;
792  if (lwgeom_get_type(geom) == COLLECTIONTYPE)
793  {
794  LWCOLLECTION *g = (LWCOLLECTION*)geom;
795  geom_out = (LWGEOM *)lwcollection_extract(g, original_type);
796  }
797 
798  /* If a collection only contains 1 geometry return than instead */
799  if (lwgeom_is_collection(geom_out))
800  {
801  LWCOLLECTION *g = (LWCOLLECTION *)geom_out;
802  if (g->ngeoms == 1)
803  {
804  geom_out = g->geoms[0];
805  }
806  }
807 
808  geom_out->srid = geom->srid;
809  return geom_out;
810 }
#define COLLECTIONTYPE
Definition: liblwgeom.h:122
LWCOLLECTION * lwcollection_extract(const LWCOLLECTION *col, uint32_t type)
Definition: lwcollection.c:432
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1080
static uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition: lwinline.h:145
uint32_t ngeoms
Definition: liblwgeom.h:594
LWGEOM ** geoms
Definition: liblwgeom.h:589
int32_t srid
Definition: liblwgeom.h:474

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

Referenced by mvt_clip_and_validate(), and mvt_geom().

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