Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
geocoder: function (key, options) {
var params = APIKeyCheck.getKeyAndOptions(key, options);
return new MapzenControlGeocoder.class(params.key, params.options); // eslint-disable-line
},
module.exports.controlGeocoder = function (key, options) {
var params = APIKeyCheck.getKeyAndOptions(key, options);
if (!APIKeyCheck.isValidMapzenApiKey(params.key)) {
APIKeyCheck.throwApiKeyWarning('Search');
}
return new MapzenControlGeocoder.class(params.key, params.options); // eslint-disable-line
};
return L.icon({
iconUrl: markerList[1],
iconSize: [20, 56],
iconAnchor: [10, 28]
});
} else {
return L.icon({
iconUrl: url,
iconSize: [20, 56],
iconAnchor: [10, 28]
});
}
}
var plan = new ReversablePlan([], {
geocoder: Geocoder.nominatim(),
routeWhileDragging: true,
createMarker: function(i, wp, n) {
var options = {
draggable: this.draggableWaypoints,
icon: makeIcon(i, n)
};
var marker = L.marker(wp.latLng, options);
marker.on('click', function() {
plan.spliceWaypoints(i, 1);
});
return marker;
},
routeDragInterval: 100,
addWaypoints: true,
waypointMode: 'snap',
position: 'topright',
return L.icon({
iconUrl: markerList[1],
iconSize: [20, 56],
iconAnchor: [10, 28]
});
} else {
return L.icon({
iconUrl: url,
iconSize: [20, 56],
iconAnchor: [10, 28]
});
}
}
var plan = new ReversablePlan([], {
geocoder: Geocoder.nominatim(),
routeWhileDragging: true,
createMarker: function(i, wp, n) {
var options = {
draggable: this.draggableWaypoints,
icon: makeIcon(i, n)
};
var marker = L.marker(wp.latLng, options);
marker.on('click', function() {
plan.spliceWaypoints(i, 1);
});
return marker;
},
routeDragInterval: options.lrm.routeDragInterval,
addWaypoints: true,
waypointMode: 'snap',
position: 'topright',
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)
_buildGeocoder() {
const lang = document.l10n.supportedLocales[0];
const bounds = this._radio.reqres.request('map:currentBounds');
const left = bounds._southWest.lng;
const top = bounds._northEast.lat;
const right = bounds._northEast.lng;
const bottom = bounds._southWest.lat;
const { lat, lng } = this._radio.reqres.request('map:currentCenter');
switch (this.model.get('geocoder')) {
case CONST.geocoder.nominatim:
return leafletControlGeocoder.nominatim({
geocodingQueryParams: {
viewbox: `${left},${top},${right},${bottom}`,
'accept-language': lang
}
});
default:
return leafletControlGeocoder.photon({
geocodingQueryParams: {
lat,
lon: lng,
lang
}
});
}
}
});
const left = bounds._southWest.lng;
const top = bounds._northEast.lat;
const right = bounds._northEast.lng;
const bottom = bounds._southWest.lat;
const { lat, lng } = this._radio.reqres.request('map:currentCenter');
switch (this.model.get('geocoder')) {
case CONST.geocoder.nominatim:
return leafletControlGeocoder.nominatim({
geocodingQueryParams: {
viewbox: `${left},${top},${right},${bottom}`,
'accept-language': lang
}
});
default:
return leafletControlGeocoder.photon({
geocodingQueryParams: {
lat,
lon: lng,
lang
}
});
}
}
});