PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ ST_LocateBetweenElevations()

Datum ST_LocateBetweenElevations ( PG_FUNCTION_ARGS  )

Definition at line 151 of file lwgeom_functions_lrs.c.

152 {
153  GSERIALIZED *geom_in = PG_GETARG_GSERIALIZED_P(0);
154  double from = PG_GETARG_FLOAT8(1);
155  double to = PG_GETARG_FLOAT8(2);
156  LWCOLLECTION *geom_out = NULL;
157  LWGEOM *line_in = NULL;
158  static char ordinate = 'Z'; /* Z */
159  static double offset = 0.0;
160 
161  if ( ! gserialized_has_z(geom_in) )
162  {
163  elog(ERROR,"This function only accepts LINESTRING or MULTILINESTRING with Z dimensions.");
164  PG_RETURN_NULL();
165  }
166 
167  line_in = lwgeom_from_gserialized(geom_in);
168  geom_out = lwgeom_clip_to_ordinate_range(line_in, ordinate, from, to, offset);
169  lwgeom_free(line_in);
170  PG_FREE_IF_COPY(geom_in, 0);
171 
172  if ( ! geom_out )
173  {
174  elog(ERROR,"lwline_clip_to_ordinate_range returned null");
175  PG_RETURN_NULL();
176  }
177 
178  PG_RETURN_POINTER(geometry_serialize((LWGEOM*)geom_out));
179 }
int gserialized_has_z(const GSERIALIZED *gser)
Check if a GSERIALIZED has a Z ordinate.
Definition: g_serialized.c:45
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
LWCOLLECTION * lwgeom_clip_to_ordinate_range(const LWGEOM *lwin, char ordinate, double from, double to, double offset)
Given a geometry clip based on the from/to range of one of its ordinates (x, y, z,...
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)

References geometry_serialize(), gserialized_has_z(), lwgeom_clip_to_ordinate_range(), lwgeom_free(), and lwgeom_from_gserialized().

Here is the call graph for this function: