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
I need to add Leaflet.Control.GPS ( https://github.com/stefanocudini/leaflet-gps ) with location picker from forms .
I need to create simple map to get point and save it to PointField() .
My knowledge about leaflet java script is not well but, but I try to follow the documentation but nothing went well :)
........
My sittings config :
class MapWidget(LeafletWidget):
geometry_field_class = 'address.GeometryField'
class NewShopForm(forms.ModelForm):
class Meta:
model = Shop
fields = ["SHname", "SHlocation"]
widgets = {'SHlocation': MapWidget()}
and in html inject script in form element :
address.GeometryField = L.GeometryField.extend({
addTo: function (map) {
var GpsControl = this._GpsControl = new L.Control.Gps();
map.on('gps:located', function(e) {
console.log(e.latlng, map.getCenter())
map.on('gps:disabled', function(e) {
e.marker.closePopup()
});
})
},
});
any help please :)
The text was updated successfully, but these errors were encountered:
I need to add Leaflet.Control.GPS ( https://github.com/stefanocudini/leaflet-gps ) with location picker from forms .
I need to create simple map to get point and save it to PointField() .
My knowledge about leaflet java script is not well but, but I try to follow the documentation but nothing went well :)
........
My sittings config :
And my forms.py :
and in html inject script in form element :
any help please :)
The text was updated successfully, but these errors were encountered: