2917{
2921 int extype = 0;
2922
2923 if (PG_NARGS() > 1)
2924 extype = PG_GETARG_INT32(1);
2925
2926
2928 {
2929 elog(ERROR, "ST_CollectionExtract: only point, linestring and polygon may be extracted");
2930 PG_RETURN_NULL();
2931 }
2932
2933 gser_in = PG_GETARG_GSERIALIZED_P(0);
2935
2936
2938 {
2939
2940 if (lwg_in->
type == extype || !extype)
2941 {
2943 PG_RETURN_POINTER(gser_in);
2944 }
2945
2946 else
2947 {
2949 PG_RETURN_POINTER(geometry_serialize(lwg_out));
2950 }
2951 }
2952
2954
2955 gser_out = geometry_serialize(lwg_out);
2958 PG_RETURN_POINTER(gser_out);
2959}
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
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 contains sub-geometries or not This basically just checks that the struct ...
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.
LWCOLLECTION * lwcollection_extract(const LWCOLLECTION *col, uint32_t type)