PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ LWGEOM_makepoint()

Datum LWGEOM_makepoint ( PG_FUNCTION_ARGS  )

Definition at line 2102 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().

2103 {
2104  double x,y,z,m;
2105  LWPOINT *point;
2106  GSERIALIZED *result;
2107 
2108  POSTGIS_DEBUG(2, "LWGEOM_makepoint called");
2109 
2110  x = PG_GETARG_FLOAT8(0);
2111  y = PG_GETARG_FLOAT8(1);
2112 
2113  if ( PG_NARGS() == 2 ) point = lwpoint_make2d(SRID_UNKNOWN, x, y);
2114  else if ( PG_NARGS() == 3 )
2115  {
2116  z = PG_GETARG_FLOAT8(2);
2117  point = lwpoint_make3dz(SRID_UNKNOWN, x, y, z);
2118  }
2119  else if ( PG_NARGS() == 4 )
2120  {
2121  z = PG_GETARG_FLOAT8(2);
2122  m = PG_GETARG_FLOAT8(3);
2123  point = lwpoint_make4d(SRID_UNKNOWN, x, y, z, m);
2124  }
2125  else
2126  {
2127  elog(ERROR, "LWGEOM_makepoint: unsupported number of args: %d",
2128  PG_NARGS());
2129  PG_RETURN_NULL();
2130  }
2131 
2132  result = geometry_serialize((LWGEOM *)point);
2133 
2134  PG_RETURN_POINTER(result);
2135 }
LWPOINT * lwpoint_make2d(int srid, double x, double y)
Definition: lwpoint.c:163
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:188
LWPOINT * lwpoint_make3dz(int srid, double x, double y, double z)
Definition: lwpoint.c:173
LWPOINT * lwpoint_make4d(int srid, double x, double y, double z, double m)
Definition: lwpoint.c:195
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
Here is the call graph for this function:
Here is the caller graph for this function: