You are viewing an older version of MapQuest.js. Check out the latest version.
A class that acts as a simple interface to the MapQuest Geocoding API. Forward, Reverse, and Batch Geocoding are supported through the class.
L.mapquest.key = 'KEY';
var geocoder = L.mapquest.geocoding({
thumbMaps: false,
maxResults: 3
});
An object containing options from the Geocoding API.
A geocoding object configured with the provided options.
Performs a forward geocode on the provided locations.
L.mapquest.key = 'KEY';
var geocoder = L.mapquest.geocoding();
geocoder.geocode(['Denver, CO', 'Boulder, CO'], geocodingCallback);
function geocodingCallback(error, result) {
console.log(result);
}
The locations parameter may be either a single location as a String, or an Array of multiple String locations. If an Array of locations is provided, the Batch Geocode API will be used.
Optional callback function. If provided, the results of the API call will be passed into the function in the error-first callback style. If not provided, geocoded locations will be displayed on the map with markers set to their locations.
If a callback is provided, the Geocoding API response will be returned.
Performs a reverse geocode on the provided lat/lng.
L.mapquest.key = 'KEY';
var geocoder = L.mapquest.geocoding();
geocoder.reverse([37.78008,-122.420168], geocodingCallback);
function geocodingCallback(error, result) {
console.log(result);
}
Either an object with lat
and lng
keys, or a lat/lng array.
Optional callback function. If provided, the results of the API call will be passed into the function in the error-first callback style. If not provided, geocoded locations will be displayed on the map with markers set to their locations.
If a callback is provided, the Geocoding API response will be returned.