PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ LWGEOM_makepoint()

Datum LWGEOM_makepoint ( PG_FUNCTION_ARGS  )

Definition at line 2109 of file lwgeom_functions_basic.c.

2110 {
2111  double x,y,z,m;
2112  LWPOINT *point;
2113  GSERIALIZED *result;
2114 
2115  POSTGIS_DEBUG(2, "LWGEOM_makepoint called");
2116 
2117  x = PG_GETARG_FLOAT8(0);
2118  y = PG_GETARG_FLOAT8(1);
2119 
2120  if ( PG_NARGS() == 2 ) point = lwpoint_make2d(SRID_UNKNOWN, x, y);
2121  else if ( PG_NARGS() == 3 )
2122  {
2123  z = PG_GETARG_FLOAT8(2);
2124  point = lwpoint_make3dz(SRID_UNKNOWN, x, y, z);
2125  }
2126  else if ( PG_NARGS() == 4 )
2127  {
2128  z = PG_GETARG_FLOAT8(2);
2129  m = PG_GETARG_FLOAT8(3);
2130  point = lwpoint_make4d(SRID_UNKNOWN, x, y, z, m);
2131  }
2132  else
2133  {
2134  elog(ERROR, "LWGEOM_makepoint: unsupported number of args: %d",
2135  PG_NARGS());
2136  PG_RETURN_NULL();
2137  }
2138 
2139  result = geometry_serialize((LWGEOM *)point);
2140 
2141  PG_RETURN_POINTER(result);
2142 }
LWPOINT * lwpoint_make2d(int srid, double x, double y)
Definition: lwpoint.c:163
LWPOINT * lwpoint_make3dz(int srid, double x, double y, double z)
Definition: lwpoint.c:173
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:188
LWPOINT * lwpoint_make4d(int srid, double x, double y, double z, double m)
Definition: lwpoint.c:195
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)

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

Here is the call graph for this function: