#6440 closed Uncategorized (fixed)
Issues with Distance conversion from meters to degrees
Reported by: | anonymous | Owned by: | jbronn |
---|---|---|---|
Component: | GIS | Version: | gis |
Severity: | Normal | Keywords: | measure distance degree conversion |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Short example :
>>> from django.contrib.gis.measure import Distance >>> d = Distance(m=1) >>> print d 1.0 m >>> print d.degree 57.2957795132
When converting, the following is executed (in measure.py) :
return self.m / self.UNITS[name]
Shouldn't it be :
return self.m * self.UNITS[name]
Or is the degree declaration wrong ?
UNITS = { .... 'degree' : 0.0174532925199, .... }
Change History (4)
comment:1 by , 17 years ago
Cc: | added |
---|---|
Keywords: | measure distance degree conversion added |
Owner: | changed from | to
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 17 years ago
Triage Stage: | Accepted → Design decision needed |
---|
The conversion factor was taken from EPSG:9122 (GML), and is equal to "= pi/180 radians" -- thus, it's not a valid meter conversion factor. Because the degree distance will vary depending on one's location on the globe, it should probably be removed from this module.
Unless I hear otherwise I'll remove -- questions, comments, ideas?
comment:3 by , 17 years ago
Cc: | removed |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Triage Stage: | Design decision needed → Accepted |
(In [7047]) gis: Removed degree conversion from Distance
-- should not have been placed here because it is a spherical conversion factor in radians (not meters).
comment:4 by , 11 years ago
Easy pickings: | unset |
---|---|
Severity: | → Normal |
Type: | → Uncategorized |
UI/UX: | unset |
Ideally, the Distance object could allow something like this --
degrees = D(km=10).degrees_at(point)
And return the degrees using a spherical projection at that point (a Point object).
Yeah, its a bug. Looks like I put in the wrong conversion factor here.