[postgis-tickets] r16091 - Default to using the tree-based geography distance

Paul Ramsey pramsey at cleverelephant.ca
Fri Nov 3 10:05:40 PDT 2017


Author: pramsey
Date: 2017-11-03 10:05:40 -0700 (Fri, 03 Nov 2017)
New Revision: 16091

Modified:
   trunk/postgis/geography_measurement.c
Log:
Default to using the tree-based geography distance 
calculation in all cases. (Closes #3528)
As implemented this results in trees being
calculated once more than is absolutely necessary
in the cached case, but changing that involves
re-working all the caching code for geos/geography/intersects
which is non-ideal.


Modified: trunk/postgis/geography_measurement.c
===================================================================
--- trunk/postgis/geography_measurement.c	2017-11-03 14:57:27 UTC (rev 16090)
+++ trunk/postgis/geography_measurement.c	2017-11-03 17:05:40 UTC (rev 16091)
@@ -243,11 +243,16 @@
 	/* Do the brute force calculation if the cached calculation doesn't tick over */
 	if ( LW_FAILURE == geography_distance_cache(fcinfo, g1, g2, &s, &distance) )
 	{
+		/* default to using tree-based distance calculation at all times */
+		/* in standard distance call. */
+		geography_tree_distance(g1, g2, &s, FP_TOLERANCE, &distance);
+		/*
 		LWGEOM* lwgeom1 = lwgeom_from_gserialized(g1);
 		LWGEOM* lwgeom2 = lwgeom_from_gserialized(g2);
 		distance = lwgeom_distance_spheroid(lwgeom1, lwgeom2, &s, tolerance);
 		lwgeom_free(lwgeom1);
 		lwgeom_free(lwgeom2);
+		*/
 	}
 
 	/* Clean up */



More information about the postgis-tickets mailing list