You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to allow the users to use their current location in the map. For this, we implemented this little script
function getLocation() {
if ("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition(showPosition, error);
} else {
$("#location-message").show()
}
}
function showPosition(position) {
$("#id_location").val(position.coords.latitude + "," + position.coords.longitude)
}
function error(err) {
$("#location-message").show()
}
it is working fine, the latitude and longitude is automatically updated; however, the marker is not. How may we force the marker to move to the new coordinates?
We tried editing the coordinates directly and it is not working either; it seems that the marker updates the coordinates field but it does not work in the other way.
This discussion was converted from issue #146 on April 04, 2023 18:47.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Good day,
We are using the library with this configuration
The model is using a
PlainLocationField
.We need to allow the users to use their current location in the map. For this, we implemented this little script
it is working fine, the latitude and longitude is automatically updated; however, the marker is not. How may we force the marker to move to the new coordinates?
We tried editing the coordinates directly and it is not working either; it seems that the marker updates the coordinates field but it does not work in the other way.
Thank you,
Beta Was this translation helpful? Give feedback.
All reactions