django-mapbox-location-field icon indicating copy to clipboard operation
django-mapbox-location-field copied to clipboard

Coordinates Stored Incorrectly in v2.1.0

Open Dresdn opened this issue 1 year ago • 2 comments
trafficstars

Hello!

After updating to v2.1.0, the value stored in the database for LocationField() has flipped on me. For example, an old record using v2.0.0 shows -99.91433437500096,44.55426270755038 (lng,lat), but after installing v2.1.0, the value is stored as 44.55426270755038,-99.91433437500096 (lat,lng).

This is a problem as rendering old values now cause problems as the -99 causes MapBox's Map() to throw an error with the invalid lat value.

First glance doesn't really indicate anything obvious as to why this changed, but this is definitely an issue as values should be stored in lng,lat format since v1.4.0.

Dresdn avatar Mar 20 '24 16:03 Dresdn

@simon-the-shark - I spent some time looking at this, and the removal of forms.LocationField.to_python() is what changed the storage of the values in the database from being lng,lat to lat,lng.

That said, what should the intended behavior be? Should this be configurable, or is this a breaking change?

Dresdn avatar Apr 06 '24 23:04 Dresdn

@simon-the-shark We have the same problem. After updating to 2.1.0 the existing locations are messed up in the view.

Legiew avatar Apr 29 '24 05:04 Legiew