1217 double from_fraction = PG_GETARG_FLOAT8(1);
1218 double to_fraction = PG_GETARG_FLOAT8(2);
1223 bool use_spheroid =
true;
1225 if ( PG_NARGS() > 3 && ! PG_ARGISNULL(3) )
1226 use_spheroid = PG_GETARG_BOOL(3);
1231 PG_FREE_IF_COPY(gs, 0);
1235 if ( from_fraction < 0 || from_fraction > 1 )
1237 elog(ERROR,
"%s: second argument is not within [0,1]", __func__);
1238 PG_FREE_IF_COPY(gs, 0);
1241 if ( to_fraction < 0 || to_fraction > 1 )
1243 elog(ERROR,
"%s: argument arg is not within [0,1]", __func__);
1244 PG_FREE_IF_COPY(gs, 0);
1247 if ( from_fraction > to_fraction )
1249 elog(ERROR,
"%s: second argument must be smaller than third argument", __func__);
1256 elog(ERROR,
"%s: first argument is not a line", __func__);
1257 PG_FREE_IF_COPY(gs, 0);
1264 if ( ! use_spheroid )
1265 s.a =
s.b =
s.radius;
1271 PG_FREE_IF_COPY(gs, 0);
1273 result = geography_serialize(lwresult);
1276 PG_RETURN_POINTER(
result);
char result[OUT_DOUBLE_BUFFER_SIZE]
int32_t gserialized_get_srid(const GSERIALIZED *g)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
void lwgeom_free(LWGEOM *geom)
LWGEOM * geography_substring(const LWLINE *line, const SPHEROID *s, double from, double to, double tolerance)
Return the part of a line between two fractional locations.
void lwline_free(LWLINE *line)
#define FP_TOLERANCE
Floating point comparators.