*
**********************************************************************/
+/*
+** Spherical radius.
+** Moritz, H. (1980). Geodetic Reference System 1980, by resolution of the XVII General Assembly of the IUGG in Canberra.
+** http://en.wikipedia.org/wiki/Earth_radius
+*/
+
+#define WGS84_RADIUS 6371009.0
/**********************************************************************
** GIDX structure.
/* Read our tolerance value. */
tolerance = PG_GETARG_FLOAT8(2);
+ tolerance = tolerance / WGS84_RADIUS;
/* Calculate the distance */
distance = lwgeom_distance_sphere(lwgeom1, lwgeom2, &gbox1, &gbox2, tolerance);
elog(ERROR, "Error in geography_distance_sphere calculation.");
PG_RETURN_NULL();
}
+
+ distance = distance * WGS84_RADIUS;
/* Clean up, but not all the way to the point arrays */
lwgeom_release(lwgeom1);