2716{
2721 int type = PG_GETARG_INT32(1);
2722 int lwgeom_type = lwgeom->
type;
2723
2724
2726 {
2728 elog(ERROR, "ST_CollectionExtract: only point, linestring and polygon may be extracted");
2729 PG_RETURN_NULL();
2730 }
2731
2732
2734 {
2735
2736 if (lwgeom_type == type)
2737 {
2739 PG_RETURN_POINTER(input);
2740 }
2741
2742 else
2743 {
2746 }
2747 }
2748 else
2749 {
2751 }
2752
2756
2757 PG_RETURN_POINTER(output);
2758}
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
LWCOLLECTION * lwcollection_extract(LWCOLLECTION *col, int type)
Takes a potentially heterogeneous collection and returns a homogeneous collection consisting only of ...
void lwgeom_free(LWGEOM *geom)
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
LWGEOM * lwgeom_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)