Opened 12 years ago

Closed 12 years ago

#6414 closed (fixed)

Add support for geodetic coordinate systems in GeoDjango distance API.

Reported by: jbronn Owned by: jbronn
Component: GIS Version: gis
Severity: Keywords: gis distance geodetic sphere
Cc: jbronn@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Currently the GeoDjango distance API will produce inaccurate results for calculating distances on geodetic coordinate systems. The PostGIS distance_sphere provides such support, however, it only works on points (see PostGIS Reference - Measurement Functions).

Also discussed on the django-users mailing list.

Change History (2)

comment:1 Changed 12 years ago by jbronn

Status: newassigned
Triage Stage: UnreviewedAccepted

The current implementation works for both PostGIS and Oracle spatial backends. The PostGIS ST_distance_spheroid routine is used for geodetic distance calculations, and is limited to point-to-point comparisons -- although it is slower than ST_distance_sphere, it is more accurate. See PostGIS documentation at ch. 6.3.2.

comment:2 Changed 12 years ago by jbronn

Resolution: fixed
Status: assignedclosed

In ([7104]). gis: Fixed #6414, and applied DRY to spatial backend internals. Changes include:

(1) Support for distance calculations on geometry fields with geodetic coordinate systems (e.g., WGS84, the default).
(2) The get_db_prep_save and get_db_prep_lookup have been moved from the spatial backends to common implementations in GeometryField.
(3) Simplified SQL construction for GeoQuerySet methods.
(4) SpatialBackend now contains all spatial backend dependent settings.

Note: See TracTickets for help on using tickets.
Back to Top