Я решил свою проблему, следуя этому сообщению
Мой код:
setting.py
# leaflet Module
LEAFLET_CONFIG = {
'DEFAULT_CENTER': (10.762622, 106.660172), #default center of your map
'DEFAULT_ZOOM': 14, #default zoom level
'MIN_ZOOM': 3,
'MAX_ZOOM': 22,
'SCALE': 'both',
'ATTRIBUTION_PRIFIX': 'tekson', #attribution of your map
'PLUGINS': {
'forms': {
'js': ['/static/leaflet_geocoder/geocoder.js', '/static/Leaflet_Coordinates/Leaflet.Coordinates-0.1.5.min.js', '/static/js_admin/leaflet_widget.js'],
'css': ['/static/leaflet_geocoder/geocoder.css', '/static/Leaflet_Coordinates/Leaflet.Coordinates-0.1.5.css'],
},
},
}
leaflet_widget. js
window.addEventListener("map:init", function (event) {
var map = event.detail.map; // Get reference to map
L.Control.geocoder(
{
collapsed: true,
geocoder: L.Control.Geocoder.nominatim({
geocodingQueryParams: {countrycodes: 'VN'}
})
}
).addTo(map);
L.control.coordinates({
position:"bottomleft", //optional default "bootomright"
decimals:6, //optional default 4
decimalSeperator:".", //optional default "."
labelTemplateLat:"Latitude: {y}", //optional default "Lat: {y}"
labelTemplateLng:"Longitude: {x}", //optional default "Lng: {x}"
enableUserInput:true, //optional default true
useDMS:false, //optional default false
useLatLngOrder: true, //ordering of labels, default false-> lng-lat
markerType: L.marker, //optional default L.marker
markerProps: {}, //optional default {},
}).addTo(map);
});