From 66319cc59724ae28917eea62643d07cc9606897d Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Fri, 9 Oct 2015 17:15:16 +0200 Subject: [PATCH] [1.9.x] Fixed #25498 -- Documented ST_Distance/ST_Distance_Sphere difference Thanks Bibhas Debnath for the report and Tim Graham for the review. Backport of 617b1a21f from master. --- docs/ref/contrib/gis/geoquerysets.txt | 35 ++++++++++++++------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/docs/ref/contrib/gis/geoquerysets.txt b/docs/ref/contrib/gis/geoquerysets.txt index d4b83e86c8..d30f1a8bef 100644 --- a/docs/ref/contrib/gis/geoquerysets.txt +++ b/docs/ref/contrib/gis/geoquerysets.txt @@ -521,7 +521,8 @@ distance lookup but :lookup:`dwithin`, an optional third element, ``'spheroid'``, may be included to tell GeoDjango to use the more accurate spheroid distance calculation functions on fields with a geodetic coordinate system (e.g., ``ST_Distance_Spheroid`` -would be used instead of ``ST_Distance_Sphere``). +would be used instead of ``ST_Distance_Sphere``). The simpler ``ST_Distance`` +function is used with projected coordinate systems. .. fieldlookup:: distance_gt @@ -535,13 +536,13 @@ Example:: Zipcode.objects.filter(poly__distance_gt=(geom, D(m=5))) -========== =============================================== +========== ================================================== Backend SQL Equivalent -========== =============================================== -PostGIS ``ST_Distance(poly, geom) > 5`` +========== ================================================== +PostGIS ``ST_Distance/ST_Distance_Sphere(poly, geom) > 5`` Oracle ``SDO_GEOM.SDO_DISTANCE(poly, geom, 0.05) > 5`` SpatiaLite ``Distance(poly, geom) > 5`` -========== =============================================== +========== ================================================== .. fieldlookup:: distance_gte @@ -555,13 +556,13 @@ Example:: Zipcode.objects.filter(poly__distance_gte=(geom, D(m=5))) -========== ================================================ +========== =================================================== Backend SQL Equivalent -========== ================================================ -PostGIS ``ST_Distance(poly, geom) >= 5`` +========== =================================================== +PostGIS ``ST_Distance/ST_Distance_Sphere(poly, geom) >= 5`` Oracle ``SDO_GEOM.SDO_DISTANCE(poly, geom, 0.05) >= 5`` SpatiaLite ``Distance(poly, geom) >= 5`` -========== ================================================ +========== =================================================== .. fieldlookup:: distance_lt @@ -575,13 +576,13 @@ Example:: Zipcode.objects.filter(poly__distance_lt=(geom, D(m=5))) -========== =============================================== +========== ================================================== Backend SQL Equivalent -========== =============================================== -PostGIS ``ST_Distance(poly, geom) < 5`` +========== ================================================== +PostGIS ``ST_Distance/ST_Distance_Sphere(poly, geom) < 5`` Oracle ``SDO_GEOM.SDO_DISTANCE(poly, geom, 0.05) < 5`` SpatiaLite ``Distance(poly, geom) < 5`` -========== =============================================== +========== ================================================== .. fieldlookup:: distance_lte @@ -595,13 +596,13 @@ Example:: Zipcode.objects.filter(poly__distance_lte=(geom, D(m=5))) -========== ================================================ +========== =================================================== Backend SQL Equivalent -========== ================================================ -PostGIS ``ST_Distance(poly, geom) <= 5`` +========== =================================================== +PostGIS ``ST_Distance/ST_Distance_Sphere(poly, geom) <= 5`` Oracle ``SDO_GEOM.SDO_DISTANCE(poly, geom, 0.05) <= 5`` SpatiaLite ``Distance(poly, geom) <= 5`` -========== ================================================ +========== =================================================== .. fieldlookup:: dwithin