I have a project with a simple 'onclick' execute identify task taken/modified from this sample:http://help.arcgis.com/en/webapi/javascript/arcgis/demos/find/find_popup.htmlWhat I want to do now is have that same function happen after a user enters in an address using the locator sample:http://help.arcgis.com/en/webapi/javascript/arcgis/demos/locator/locator_address.html.Do I need to create a separate identify function that works with the geometry of the results from the locator task?or can a get that execute identify task to fire after the geocode results get added to the map as an event?dojo.connect(map,'onClick',executeIdentifyTask);// something like this ? ? ?dojo.connect(map,"geocode results have been added to the map", executeIdentifyTask);// or would i need to look for the geocode graphic (geo)?dojo.connect(graphic,'onGraphicAdd',executeIdentifyTask);Any help/direction would be appreciated.My application can be found here:http://www.dvrpc.org/webmaps/ci2/Thanks.....Full source code is here:http://www.dvrpc.org/webmaps/ci2/js/script.jsHere's my locator code: //Locator
function locate() {
map.graphics.clear();
var address = {"SingleLine":dojo.byId("address").value};
locator.outSpatialReference= map.spatialReference;
locator.addressToLocations(address,["Loc_name"]);
}
function showResults(candidates) {
var candidate;
var symbol = new esri.symbol.SimpleMarkerSymbol();
var infoTemplate = new esri.InfoTemplate("Location", "Address: ${address}");
// var infoTemplate = new esri.InfoTemplate("Location", "Address: ${address}<br />Score: ${score}<br />Source locator: ${locatorName}");
symbol.setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE);
symbol.setSize (8);
symbol.setColor(new dojo.Color([153,0,51,0.75]));
var geom;
dojo.every(candidates,function(candidate){
console.log(candidate.score);
if (candidate.score > 80) {
console.log(candidate.location);
var attributes = { address: candidate.address};
// var attributes = { address: candidate.address, score:candidate.score, locatorName:candidate.attributes.Loc_name };
geom = candidate.location;
var graphic = new esri.Graphic(geom, symbol, attributes, infoTemplate);
//add a graphic to the map at the geocoded location
map.graphics.add(graphic);
//add a text symbol to the map listing the location of the matched address.
var displayText = candidate.address;
var font = new esri.symbol.Font("16pt",esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL,esri.symbol.Font.WEIGHT_BOLD,"Helvetica");
var textSymbol = new esri.symbol.TextSymbol(displayText,font,new dojo.Color("#666633"));
textSymbol.setOffset(0,8);
// map.graphics.add(new esri.Graphic(geom, textSymbol));
return false; //break out of loop after one candidate with score greater than 80 is found.
}
});
if(geom !== undefined){
map.centerAndZoom(geom,14);
}
}