Skip to content

Minor Improvements #30

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

Closed
urzbs opened this issue Jun 2, 2021 · 4 comments
Closed

Minor Improvements #30

urzbs opened this issue Jun 2, 2021 · 4 comments

Comments

@urzbs
Copy link

urzbs commented Jun 2, 2021

Hey,

  1. I noticed that the result for LocationField is (Long, Lat) instead of conventional (Lat, Long) - Is there any reason for this?
    When people use this value and post it to google its always on the reverse of the world because its mixed up.
    ISO 6709 - Latitude comes before longitude

  2. Is it possible to specify the size of the white Address Search Field inside the Location Picker Widget?
    A lot of Addresses are Cut Off with (...) because their Address is longer. I think it could improve user experience when you dont need to scroll inside the field to double check Addresses

All the best!

@reustle
Copy link

reustle commented Jul 4, 2021

Hey, I'm not at all involved with this project (yet) but would like to give some feedback.

Regarding point 1, I believe it's because this is a mapbox specific library, and this is the order that mapbox uses officially. https://docs.mapbox.com/help/glossary/lat-lon/

For instance, Mapbox GL JS and most Mapbox web services APIs use the format longitude,latitude

As for the size of the location field, I'm sure there's so me way to hack it using css or js, if there is no clean way to modify the size through this library.

@simon-the-shark
Copy link
Owner

Regarding the coordinates order, it's explained in README:
https://github.com/simon-the-shark/django-mapbox-location-field#versions-140

quoting:

Since version 1.4.0 the order of coordinates convention has been changed. Now the order is longitude, latitude. This change has been caused by support for spatial databases. Nevertheless, more user-friendly is order latitude, longitude(Google Maps uses it). That's why coordinates are falsely swapped in frontend and then after POST request in form field are swapped back into longitude, latitude order and saved to database.
My conclusion is that the location is falsely swapped in frontend and if you create location without our custom form field or just operate on a raw model in the backend, you will have to use the longitude, latitude order.
Versions before 1.4.0 always uses latitude, longitude order.

@simon-the-shark
Copy link
Owner

And when it comes to the size of the address field, web technologies have the advantage that you can always override the original CSS of any container. So, setting the size in your CSS files is pretty simple. Just like that:
.mapboxgl-ctrl-geocoder { max-width: unset; width: 1000px; }

Read more about css's 'width' property here: https://www.w3schools.com/cssref/pr_dim_width.asp

@simon-the-shark
Copy link
Owner

If anyone would like to contribute and build Django implementation that overrides it for the coder, I'd be happy to review and merge, but personally don't have time right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants