PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum LWGEOM_makepoint ( PG_FUNCTION_ARGS  )

Definition at line 2138 of file lwgeom_functions_basic.c.

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

2139 {
2140  double x,y,z,m;
2141  LWPOINT *point;
2143 
2144  POSTGIS_DEBUG(2, "LWGEOM_makepoint called");
2145 
2146  x = PG_GETARG_FLOAT8(0);
2147  y = PG_GETARG_FLOAT8(1);
2148 
2149  if ( PG_NARGS() == 2 ) point = lwpoint_make2d(SRID_UNKNOWN, x, y);
2150  else if ( PG_NARGS() == 3 )
2151  {
2152  z = PG_GETARG_FLOAT8(2);
2153  point = lwpoint_make3dz(SRID_UNKNOWN, x, y, z);
2154  }
2155  else if ( PG_NARGS() == 4 )
2156  {
2157  z = PG_GETARG_FLOAT8(2);
2158  m = PG_GETARG_FLOAT8(3);
2159  point = lwpoint_make4d(SRID_UNKNOWN, x, y, z, m);
2160  }
2161  else
2162  {
2163  elog(ERROR, "LWGEOM_makepoint: unsupported number of args: %d",
2164  PG_NARGS());
2165  PG_RETURN_NULL();
2166  }
2167 
2168  result = geometry_serialize((LWGEOM *)point);
2169 
2170  PG_RETURN_POINTER(result);
2171 }
LWPOINT * lwpoint_make2d(int srid, double x, double y)
Definition: lwpoint.c:130
char ** result
Definition: liblwgeom.h:218
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:154
LWPOINT * lwpoint_make3dz(int srid, double x, double y, double z)
Definition: lwpoint.c:140
tuple x
Definition: pixval.py:53
LWPOINT * lwpoint_make4d(int srid, double x, double y, double z, double m)
Definition: lwpoint.c:162
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
tuple y
Definition: pixval.py:54

Here is the call graph for this function: