3079{
3083 const char *ospec;
3085
3086 ospec = PG_GETARG_CSTRING(1);
3087 if (strlen(ospec) != 2)
3088 {
3089 lwpgerror(
3090 "Invalid ordinate specification. "
3091 "Need two letters from the set (x,y,z,m). "
3092 "Got '%s'",
3093 ospec);
3094 PG_RETURN_NULL();
3095 }
3098
3099 in = PG_GETARG_GSERIALIZED_P_COPY(0);
3100
3101
3103 {
3104 lwpgerror("Geometry does not have an M ordinate");
3105 PG_RETURN_NULL();
3106 }
3108 {
3109 lwpgerror("Geometry does not have a Z ordinate");
3110 PG_RETURN_NULL();
3111 }
3112
3113
3114 if (o1 == o2)
3115 PG_RETURN_POINTER(in);
3116
3119 out = geometry_serialize(lwgeom);
3121 PG_FREE_IF_COPY(in, 0);
3122 PG_RETURN_POINTER(out);
3123}
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int gserialized_has_m(const GSERIALIZED *g)
Check if a GSERIALIZED has an M ordinate.
int gserialized_has_z(const GSERIALIZED *g)
Check if a GSERIALIZED has a Z ordinate.
void lwgeom_free(LWGEOM *geom)
void lwgeom_swap_ordinates(LWGEOM *in, LWORD o1, LWORD o2)
Swap ordinate values in every vertex of the geometry.
enum LWORD_T LWORD
Ordinate names.
static LWORD ordname2ordval(char n)