locator = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"); locator.on("address-to-locations-complete", showResults); //locatorReverse = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"); locator.on("location-to-address-complete", function(evt) { if (evt.address.address) { var address = evt.address.address; var location = webMercatorUtils.geographicToWebMercator(evt.address.location); } }); map.on("click", function(evt) { locator.locationToAddress(webMercatorUtils.webMercatorToGeographic(evt.mapPoint), 100); }); // listen for Locate button click then geocode registry.byId("locate").on("click", locate);
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.