Opened 9 years ago

Closed 9 years ago

Last modified 3 years ago

#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


Short example :

>>> from django.contrib.gis.measure import Distance
>>> d = Distance(m=1)
>>> print d
1.0 m
>>> print

When converting, the following is executed (in :

return self.m / self.UNITS[name]

Shouldn't it be :

return self.m * self.UNITS[name]

Or is the degree declaration wrong ?

    'degree' : 0.0174532925199,

Change History (4)

comment:1 Changed 9 years ago by jbronn

Cc: jbronn@… added
Keywords: measure distance degree conversion added
Needs documentation: unset
Needs tests: unset
Owner: changed from nobody to jbronn
Patch needs improvement: unset
Status: newassigned
Triage Stage: UnreviewedAccepted

Yeah, its a bug. Looks like I put in the wrong conversion factor here.

comment:2 Changed 9 years ago by jbronn

Triage Stage: AcceptedDesign 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 Changed 9 years ago by jbronn

Cc: jbronn@… removed
Resolution: fixed
Status: assignedclosed
Triage Stage: Design decision neededAccepted

(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 Changed 3 years ago by Simon Litchfield

Easy pickings: unset
Severity: Normal
Type: Uncategorized
UI/UX: unset
Last edited 3 years ago by Simon Litchfield (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top