483{
489 bool use_spheroid = PG_GETARG_BOOL(3);
490 LWGEOM *lwgeom1, *lwgeom2;
493
494
496
497
498 if ( ! use_spheroid )
499 {
500 sphere->
a = sphere->
b = sphere->
radius;
501 }
502
505 {
506 elog(ERROR, "geometry_distance_spheroid: Only point/line/polygon supported.\n");
507 PG_RETURN_NULL();
508 }
509
512 {
513 elog(ERROR, "geometry_distance_spheroid: Only point/line/polygon supported.\n");
514 PG_RETURN_NULL();
515 }
516
517
520
521
526
528
530
531}
void gserialized_error_if_srid_mismatch(const GSERIALIZED *g1, const GSERIALIZED *g2, const char *funcname)
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
double lwgeom_distance_spheroid(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2, const SPHEROID *spheroid, double tolerance)
Calculate the geodetic distance from lwgeom1 to lwgeom2 on the spheroid.
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
void spheroid_init(SPHEROID *s, double a, double b)
Initialize a spheroid object for use in geodetic functions.
#define LW_TRUE
Return types for functions with status returns.
static double distance(double x1, double y1, double x2, double y2)