PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ 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 771 of file mvt.c.

772 {
773  LWGEOM *geom_out = geom;
774  if (lwgeom_get_type(geom) == COLLECTIONTYPE)
775  {
776  LWCOLLECTION *g = (LWCOLLECTION*)geom;
777  geom_out = (LWGEOM *)lwcollection_extract(g, original_type);
778  }
779 
780  /* If a collection only contains 1 geometry return than instead */
781  if (lwgeom_is_collection(geom_out))
782  {
783  LWCOLLECTION *g = (LWCOLLECTION *)geom_out;
784  if (g->ngeoms == 1)
785  {
786  geom_out = g->geoms[0];
787  }
788  }
789 
790  geom_out->srid = geom->srid;
791  return geom_out;
792 }
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition: lwgeom.c:923
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1085
LWCOLLECTION * lwcollection_extract(LWCOLLECTION *col, int type)
Takes a potentially heterogeneous collection and returns a homogeneous collection consisting only of ...
Definition: lwcollection.c:386
uint32_t ngeoms
Definition: liblwgeom.h:510
LWGEOM ** geoms
Definition: liblwgeom.h:512
int32_t srid
Definition: liblwgeom.h:402

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

Referenced by 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: