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

Coordinates are not the same after form error

Open itekhi opened this issue 3 years ago • 10 comments
trafficstars

So I click on the map, everything is great, coordinates are good, when I save the form everything is good too, even if I then edit the form and save again it works great. Screenshot 2022-04-11 at 02 44 12

But when form has errors, page reloads, and coordinates are messed up for some reason, and now I'm in Africa 😄 Coordinates are kinda same, just missing first number in the second coordinate... Screenshot 2022-04-11 at 02 47 12

I actually don't know, but maybe it is something with Firefox, it should work, there's no reason to fail like that...

IMO

I didn't fully review your js code, but I saw that there's some guessing with lat/lng coords. I will review it a bit further and maybe make a PR if I will have time. I think lat and lng should always be lat/lng, not lng/lat...

P.S. Thank you for your work, this project is working better than any other django map library out there!

itekhi avatar Apr 11 '22 00:04 itekhi

I'll try to find some time to look into it. Regarding the coordinates' order, I've explained myself in docs: https://github.com/simon-the-shark/django-mapbox-location-field#versions-140

simon-the-shark avatar Apr 11 '22 20:04 simon-the-shark

The EPSG:4326 standard is clear: it should be lat/lng. However, most spatial software such as PostGIS uses lng/lat

simon-the-shark avatar Apr 11 '22 20:04 simon-the-shark

I think I've got it worked out. Should be rolling out a patch in the upcoming days.

simon-the-shark avatar Apr 11 '22 22:04 simon-the-shark

@simon-the-shark Thanks a lot! Also there's another issue(kinda), but I'll mention it here: I think when pasting coordinates to coordinates field, map should react to that... I don't know if it's an issue or another feature to add 😄.

itekhi avatar Apr 24 '22 16:04 itekhi

The EPSG:4326 standard is clear: it should be lat/lng. However, most spatial software such as PostGIS uses lng/lat

Is the patch available somewhere? Need help testing/finishing it up? Thanks!

davidegalletti avatar Jul 24 '22 09:07 davidegalletti

Is the patch available somewhere? Need help testing/finishing it up? Thanks!

I have made an ugly patch as I have to deploy the application. Probably not general enough to make a pull request but if anyone needs it please ask replying to this message

davidegalletti avatar Jul 30 '22 16:07 davidegalletti

Which issue are you referring to?

simon-the-shark avatar Jul 30 '22 16:07 simon-the-shark

The one in this page: "Coordinates are not the same after form error #38 "

davidegalletti avatar Jul 30 '22 17:07 davidegalletti

I still have an inconsistent behavior with regards to coordinate order rendered in the widget map, it's hard to replicate so I won't go into details until I have some more information. Can you confirm if this problem was fixed in version 2.0.0 though?

h3x4git avatar Aug 03 '22 13:08 h3x4git

I think I've got it worked out. Should be rolling out a patch in the upcoming days.

I recall working on it but the issue is from Apr and the latest release is from Mar, so there's no option for the patch to be included in 2.0. Something weird happened here. ¯_(ツ)_/¯ 🤷🏻‍♂️ I have no idea where this patch is 🤷🏻‍♂️ I will try to sit down to it soon and investigate further again.

simon-the-shark avatar Aug 03 '22 14:08 simon-the-shark