Opened 22 months ago

Last modified 22 months ago

#27464 assigned Cleanup/optimization

SRID should be stored in DB on MySQL backend

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

Description

MySQL does not support SRID constraints on columns and SRID is stored together with the geometry itself.
Django always saves geometries with SRID 0 on MySQL backend.
This leads to the problem I encountered while working on #26967: AsGeoJSON function never returns the coordinate system because SRID is always 0.
Probably such Django behavior will lead to more problems in the future (e.g. if/when MySQL will get ST_Transform function).

Saving SRID will be breaking change because the old geometries in DB will have SRID 0, Django will provide geometries with SRID and MySQL 5.7+ raises error if geometry arguments have different SRIDs. To make it work MySQL users will have to set SRIDs for geometries in DB (call save() for every object of every GIS model).

Change History (2)

comment:1 Changed 22 months ago by Sergey Fedoseev

Owner: changed from nobody to Sergey Fedoseev
Status: newassigned

comment:2 Changed 22 months ago by Tim Graham

Triage Stage: UnreviewedAccepted

I'm not a GIS user, but based on the description, it seems like it could be a large backwards-incompatibility. It might be nice to raise it on the geodjango mailing list to make sure there's consensus about it.

Note: See TracTickets for help on using tickets.
Back to Top