[Django] #27573: Distance function returns Distance object instead of raw value on MySQL

6 views
Skip to first unread message

Django

unread,
Dec 5, 2016, 12:58:35 PM12/5/16
to django-...@googlegroups.com
#27573: Distance function returns Distance object instead of raw value on MySQL
-------------------------------------------+------------------------
Reporter: Sergey Fedoseev | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
https://docs.djangoproject.com/en/1.9/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Distance
> On MySQL, a raw float value is returned, as it’s not possible to
automatically determine the unit of the field.
but
{{{
In [3]: City.objects.annotate(d=Distance('point', Point(0, 0,
srid=4326))).first().d
Out[3]: Distance(m=1.41421356237)
}}}

I see two ways how to fix it:
1. made Distance function to return raw values on MySQL
2. raise NotImplemented if Distance function is applied to geodetic field

--
Ticket URL: <https://code.djangoproject.com/ticket/27573>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 5, 2016, 12:58:41 PM12/5/16
to django-...@googlegroups.com
#27573: Distance function returns Distance object instead of raw value on MySQL
-------------------------------------+-------------------------------------
Reporter: Sergey Fedoseev | Owner: Sergey
| Fedoseev
Type: Bug | Status: assigned
Component: GIS | Version: 1.9
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sergey Fedoseev):

* owner: nobody => Sergey Fedoseev
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/27573#comment:1>

Django

unread,
Dec 16, 2016, 10:13:31 AM12/16/16
to django-...@googlegroups.com
#27573: Distance function returns Distance object instead of raw value on MySQL
-------------------------------------+-------------------------------------
Reporter: Sergey Fedoseev | Owner: Sergey
| Fedoseev
Type: Bug | Status: assigned
Component: GIS | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/27573#comment:2>

Django

unread,
Apr 2, 2017, 8:21:37 AM4/2/17
to django-...@googlegroups.com
#27573: Distance function returns Distance object instead of raw value on MySQL
-------------------------------------+-------------------------------------
Reporter: Sergey Fedoseev | Owner: Sergey
| Fedoseev
Type: Bug | Status: assigned
Component: GIS | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sergey Fedoseev):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/8287 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/27573#comment:3>

Django

unread,
Apr 2, 2017, 5:06:15 PM4/2/17
to django-...@googlegroups.com
#27573: Distance function returns Distance object instead of raw value on MySQL
-------------------------------------+-------------------------------------
Reporter: Sergey Fedoseev | Owner: Sergey
| Fedoseev
Type: Bug | Status: closed
Component: GIS | Version: 1.9
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"898e623db0fa6b2cf0b187a3db78b675cde111cf" 898e623]:
{{{
#!CommitTicketReference repository=""
revision="898e623db0fa6b2cf0b187a3db78b675cde111cf"
Fixed #27573 -- Made Distance on geodetic coordinates return a raw value
on MySQL.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27573#comment:4>

Reply all
Reply to author
Forward
0 new messages