2851{
2855 const char *ospec;
2857
2858 ospec = PG_GETARG_CSTRING(1);
2859 if (strlen(ospec) != 2)
2860 {
2861 lwpgerror(
2862 "Invalid ordinate specification. "
2863 "Need two letters from the set (x,y,z,m). "
2864 "Got '%s'",
2865 ospec);
2866 PG_RETURN_NULL();
2867 }
2870
2871 in = PG_GETARG_GSERIALIZED_P_COPY(0);
2872
2873
2875 {
2876 lwpgerror("Geometry does not have an M ordinate");
2877 PG_RETURN_NULL();
2878 }
2880 {
2881 lwpgerror("Geometry does not have a Z ordinate");
2882 PG_RETURN_NULL();
2883 }
2884
2885
2886 if (o1 == o2)
2887 PG_RETURN_POINTER(in);
2888
2893 PG_FREE_IF_COPY(in, 0);
2894 PG_RETURN_POINTER(out);
2895}
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)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)