dojo.require("esri.virtualearth.VEGeocoder");
Description
(Added at v1.4)
Bing Maps geocoder. See
Locator for geocoding with ArcGIS Server locators. If you are working with the 1.x version of the ArcGIS JavaScript API, you will need to use token.
Note: there are restrictions when using Bing Maps geocoding:
- Geocodes may not be stored for any purpose except caching for performance.
- Geocodes may not be displayed on any map other than a Bing Map.
For more information on the Bing Maps terms of use, see the
Microsoft Bing Maps Services Terms of Use.
Samples
Search for
samples that use this class.
Constructors
Properties
Methods
Events
[ On Style Events | Connect Style Event ]
All On Style event listeners receive a single event object. Additionally, the event object also contains a 'target' property whose value is the object which fired the event.
Constructor Details
Creates a new VEGeocoder object.
Parameters:
<Object > options |
Required |
See options list for parameters. |
Sample:
veGeocoder = new esri.virtualearth.VEGeocoder({
bingMapsKey:'Enter Bing Maps Key Here'
});
Property Details
Method Details
Sends a geocode request to Bing Maps to find candidates for a single address specified in the query argument. On completion, the onAddressToLocationsComplete event is fired and the optional callback function is invoked.
Parameters:
<String > query |
Required |
The address to locate. |
<Function > callback |
Optional |
The function to call when the method has completed. The arguments in the function are the same as the onAddressToLocationsComplete event. |
<Function > errback |
Optional |
An error object is returned if an error occurs during task execution. |
Sample:
var query = "380 New York St, Redlands, CA, 92373";
veGeocoder.addressToLocations(query);
Sets the culture in which to return results.
Parameters:
<String > culture |
Required |
The culture value. The default value is "en-US". For a list of supported cultures, see https://learn.microsoft.com/en-us/previous-versions/cc981048(v=msdn.10). |
Event Details
[ On Style Events | Connect Style Event ]
Fires when VEGeocode.addressToLocation() has completed. The result is an array of
VEGeocodeResult. This is the same signature returned if the optional callback is specified.
(Added at v3.6) Event Object Properties:
<VEGeocodeResult[] > geocodeResults |
Contains an array of candidates that match the given address as well as their scores. |
Sample:
require([
"dojo/_base/connect", "esri/geometry/webMercatorUtils", "esri/symbols/SimpleMarkerSymbol",
"esri/Color", "esri/graphic", ...
], function(connect, webMercatorUtils, SimpleMarkerSymbol, Color, Graphic, ... ) {
connect.connect(veGeocoder, "onAddressToLocationsComplete", function(geocodeResults) {
var pointMeters = webMercatorUtils.geographicToWebMercator(geocodeResults[0].location);
var pointSymbol = new SimpleMarkerSymbol().setSize(15).setColor(new Color("blue"));
var locationGraphic = new Graphic(pointMeters,pointSymbol);
map.graphics.add(locationGraphic);
});
...
});
Fires when an error occurs when executing the task. (Added at v3.6)
Fires when VEGeocode.addressToLocation() has completed. The result is an array of
VEGeocodeResult. This is the same signature returned if the optional callback is specified.
Event Object Properties:
<VEGeocodeResult[] > geocodeResults |
Contains an array of candidates that match the given address as well as their scores. |
Sample:
dojo.connect(veGeocoder, "onAddressToLocationsComplete", function(geocodeResults) {
var pointMeters = esri.geometry.geographicToWebMercator(geocodeResults[0].location);
var pointSymbol = new esri.symbol.SimpleMarkerSymbol().setSize(15).setColor(new esri.Color("blue"));
var locationGraphic = new esri.Graphic(pointMeters,pointSymbol);
map.graphics.add(locationGraphic);
});
Fires when an error occurs when executing the task.