Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow flipping mapbox coordinates to/from db #1231

Merged
merged 1 commit into from
Mar 26, 2016

Conversation

jacobsvante
Copy link
Contributor

The current Leaflet implementation expects coordinates in latitude-longitude order but GeoJSON and PostGIS works the other way around with longitude first. These changes work around this behavior by passing the data to and from the db through PostGIS’s ST_FlipCoordinates function if the setting MAPBOX_FIX_COORDINATES_ORDER is set to something truthy. It's an opt-in so we don't break the current behavior. A warning is emitted when this setting is not enabled, but I would recommend to remove this setting and make its behavior the default in the next major version.

The commit isn't really as big as it seems, my fingers were just itching to make the code a bit more readable. Basically the only change is the new _flip_coordinates method, which is a no-op without the new setting.

The current Leaflet implementation expects coordinates in latitude-longitude order but GeoJSON and PostGIS works the other way around with lng first. These changes work around this behavior by passing the data to and from db through PostGIS’s `ST_FlipCoordinates` function if the setting `MAPBOX_FIX_POINT_COORDINATES` is something truthy. This is to not break the current behavior. Right now a warning is emitted when this setting hasn’t been enabled but I would recommend to remove this setting and make its behavior the default in the next major version.
@pawl pawl merged commit bc0f282 into pallets-eco:master Mar 26, 2016
jacobsvante added a commit to jacobsvante/flask-admin that referenced this pull request Sep 29, 2016
Mistake on my part. See discussion in pallets-eco#1341.
jacobsvante added a commit to jacobsvante/flask-admin that referenced this pull request Sep 29, 2016
Mistake on my part. See discussion in pallets-eco#1341.

Fixes pallets-eco#1341
jacobsvante added a commit to jacobsvante/flask-admin that referenced this pull request Oct 23, 2016
Mistake on my part. See discussion in pallets-eco#1341.
mrjoes added a commit that referenced this pull request Oct 24, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants