Opened 17 years ago

Closed 17 years ago

Last modified 11 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

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 jbronn, 17 years ago

Cc: jbronn@… added
Keywords: measure distance degree conversion added
Owner: changed from nobody to jbronn
Status: newassigned
Triage Stage: UnreviewedAccepted

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

comment:2 by jbronn, 17 years ago

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 by jbronn, 17 years ago

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 by Simon Litchfield, 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).

Version 0, edited 11 years ago by Simon Litchfield (next)
Note: See TracTickets for help on using tickets.
Back to Top