489 bool use_spheroid = PG_GETARG_BOOL(3);
490 LWGEOM *lwgeom1, *lwgeom2;
498 if ( ! use_spheroid )
500 sphere->
a = sphere->
b = sphere->
radius;
506 elog(ERROR,
"geometry_distance_spheroid: Only point/line/polygon supported.\n");
513 elog(ERROR,
"geometry_distance_spheroid: Only point/line/polygon supported.\n");
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_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)