PostGIS  3.4.0dev-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 815 of file mvt.c.

816 {
817  LWGEOM *geom_out = geom;
818  if (lwgeom_get_type(geom) == COLLECTIONTYPE)
819  {
820  LWCOLLECTION *g = (LWCOLLECTION*)geom;
821  geom_out = (LWGEOM *)lwcollection_extract(g, original_type);
822  }
823 
824  /* If a collection only contains 1 geometry return than instead */
825  if (lwgeom_is_collection(geom_out))
826  {
827  LWCOLLECTION *g = (LWCOLLECTION *)geom_out;
828  if (g->ngeoms == 1)
829  {
830  geom_out = g->geoms[0];
831  }
832  }
833 
834  geom_out->srid = geom->srid;
835  return geom_out;
836 }
#define COLLECTIONTYPE
Definition: liblwgeom.h:108
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:1097
static uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition: lwinline.h:145
uint32_t ngeoms
Definition: liblwgeom.h:580
LWGEOM ** geoms
Definition: liblwgeom.h:575
int32_t srid
Definition: liblwgeom.h:460

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: