PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ LWGEOM_makepoint()

Datum LWGEOM_makepoint ( PG_FUNCTION_ARGS  )

Definition at line 2133 of file lwgeom_functions_basic.c.

References geometry_serialize(), LWGEOM_makepoint3dm(), lwpoint_make2d(), lwpoint_make3dz(), lwpoint_make4d(), PG_FUNCTION_INFO_V1(), SRID_UNKNOWN, pixval::x, and pixval::y.

Referenced by ST_IsCollection().

2134 {
2135  double x,y,z,m;
2136  LWPOINT *point;
2137  GSERIALIZED *result;
2138 
2139  POSTGIS_DEBUG(2, "LWGEOM_makepoint called");
2140 
2141  x = PG_GETARG_FLOAT8(0);
2142  y = PG_GETARG_FLOAT8(1);
2143 
2144  if ( PG_NARGS() == 2 ) point = lwpoint_make2d(SRID_UNKNOWN, x, y);
2145  else if ( PG_NARGS() == 3 )
2146  {
2147  z = PG_GETARG_FLOAT8(2);
2148  point = lwpoint_make3dz(SRID_UNKNOWN, x, y, z);
2149  }
2150  else if ( PG_NARGS() == 4 )
2151  {
2152  z = PG_GETARG_FLOAT8(2);
2153  m = PG_GETARG_FLOAT8(3);
2154  point = lwpoint_make4d(SRID_UNKNOWN, x, y, z, m);
2155  }
2156  else
2157  {
2158  elog(ERROR, "LWGEOM_makepoint: unsupported number of args: %d",
2159  PG_NARGS());
2160  PG_RETURN_NULL();
2161  }
2162 
2163  result = geometry_serialize((LWGEOM *)point);
2164 
2165  PG_RETURN_POINTER(result);
2166 }
LWPOINT * lwpoint_make2d(int srid, double x, double y)
Definition: lwpoint.c:145
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:187
LWPOINT * lwpoint_make3dz(int srid, double x, double y, double z)
Definition: lwpoint.c:155
LWPOINT * lwpoint_make4d(int srid, double x, double y, double z, double m)
Definition: lwpoint.c:177
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
Here is the call graph for this function:
Here is the caller graph for this function: