Opened 8 years ago

Last modified 3 years ago

#27574 new New feature

support geodetic distance calculation on MySQL 5.7+

Reported by: Sergey Fedoseev Owned by:
Component: GIS Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

ST_Distance_Sphere function that returns geodetic distance was added in MySQL 5.7.6.

Change History (7)

comment:1 by Sergey Fedoseev, 8 years ago

Owner: changed from nobody to Sergey Fedoseev
Status: newassigned

comment:2 by Tim Graham, 8 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Tobias Krönke, 4 years ago

I would like to note, that ST_Area also works with MySQL (https://dev.mysql.com/doc/refman/5.7/en/gis-polygon-property-functions.html#function_st-area), although Django denies its execution:

Region.objects.order_by(RawSQL('ST_Area(polygon)', params=[]))
<QuerySet [<Region: Region object (1)>, '...(remaining elements truncated)...']>

assuming model Region with field polygon = PolygonField(srid=4326, spatial_index=True).

in contrast that errors with contributed Area:

from django.contrib.gis.db.models.functions import Area
Region.objects.order_by(Area('polygon'))
...
django.db.utils.NotSupportedError: Area on geodetic coordinate systems not supported.
Last edited 4 years ago by Tobias Krönke (previous) (diff)

comment:4 by Mariusz Felisiak, 4 years ago

Owner: Sergey Fedoseev removed
Status: assignednew

comment:5 by Shinya Okano, 4 years ago

Owner: set to Shinya Okano
Status: newassigned

I created the patch PR.

Updated the Distance function and be able to use distance lookup on MySQL.

comment:6 by Tim Graham, 4 years ago

Has patch: set
Patch needs improvement: set

Please uncheck "patch needs improvement" after addressing the test failures and other review comments. If the tests are passing locally, perhaps it's a difference between the versions that Jenkins uses.

comment:7 by Mariusz Felisiak, 3 years ago

Owner: Shinya Okano removed
Status: assignednew
Note: See TracTickets for help on using tickets.
Back to Top