Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.$nextTick(() => {
let map = this.$refs.myMap.mapObject
var geocoder = new L.Control.Geocoder({
defaultMarkGeocode: false, position: 'topleft'
}).on('markgeocode', function (e) {
var pos = { lat: e.geocode.center.lat, lng: e.geocode.center.lng }
that.mapCenter = [ pos.lat, pos.lng ]
pos.accuracy = 100
var loc = {
short_name: (pos.accuracy > 500 ? 'Near ' : '') + 'Lat ' + pos.lat.toFixed(3) + '° Lon ' + pos.lng.toFixed(3) + '°',
country: 'Unknown',
lng: pos.lng,
lat: pos.lat,
alt: pos.alt ? pos.alt : 0,
accuracy: pos.accuracy,
street_address: ''
}
let res = e.geocode.properties
let city = res.address.city ? res.address.city : (res.address.village ? res.address.village : res.name)