Use `ST_distance_sphere` as default instead of `ST_distance_spheroid` for geodetic distance calculations.
|Reported by:||jbronn||Owned by:||jbronn|
|Severity:||Keywords:||gis distance geodetic geographic sphere spheroid|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||no|
As brought up by kmishler in this django-users thread about GeoDjango geodetic distances,
ST_distance_sphere performs faster than
ST_distance_spheroid. My informal tests suggest that using
ST_distance_sphere yields results ~30-40% faster that are a maximum of 0.25% less accurate.
The attached patch changes the default to
ST_distance_sphere -- spheroid calculations may be enabled by setting the
distance_spheroid keyword to
True in the geographic model definition (e.g.,
point = models.PointField(distance_spheroid=True)). I haven't committed this yet because I wanted to solicit comments on whether there's a better way to do this.