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

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

815{
816 LWGEOM *geom_out = geom;
817 if (lwgeom_get_type(geom) == COLLECTIONTYPE)
818 {
819 LWCOLLECTION *g = (LWCOLLECTION*)geom;
820 geom_out = (LWGEOM *)lwcollection_extract(g, original_type);
821 }
822
823 /* If a collection only contains 1 geometry return than instead */
824 if (lwgeom_is_collection(geom_out))
825 {
826 LWCOLLECTION *g = (LWCOLLECTION *)geom_out;
827 if (g->ngeoms == 1)
828 {
829 geom_out = g->geoms[0];
830 }
831 }
832
833 geom_out->srid = geom->srid;
834 return geom_out;
835}
#define COLLECTIONTYPE
Definition liblwgeom.h:108
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM contains sub-geometries or not This basically just checks that the struct ...
Definition lwgeom.c:1125
LWCOLLECTION * lwcollection_extract(const LWCOLLECTION *col, uint32_t type)
static uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition lwinline.h:141
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: