All of a sudden - with no code update from me - the symbols for the identifytask on my web application have stopped rendering. Has anyone else experienced this?
Do you have a public site or can you post your code here or on jsbin ?
Does this help?
function initFunctionality () {
map.on("click", doIdentify);
identifyTask = new IdentifyTask("SERVICEURL");
identifyParams = new IdentifyParameters();
identifyParams.tolerance = 10;
identifyParams.returnGeometry = true;
identifyParams.layerIds = [0,3,5,7,10,11,14,22,25,26];
identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;
identifyParams.width = map.width;
identifyParams.height = map.height;
symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
new Color([143, 73, 102]), 2),
new Color([143, 73, 102, 0.25]));
//if there are url params zoom to location
var coords, zoomLevel;
var urlObject = esri.urlToObject(document.location.href);
if(urlObject.query && urlObject.query.coords && urlObject.query.zoomLevel){
var coords = urlObject.query.coords.split(',');
var lon = parseFloat(coords[0]);
var lat = parseFloat(coords[1]);
var zoomLevel = parseInt(urlObject.query.zoomLevel);
var point = esri.geometry.geographicToWebMercator(new esri.geometry.Point(lon,lat));
map.centerAndZoom(point,zoomLevel);
}
}
For me it would help if the full JavaScript were there including your require statements and web services. Are you able to post the whole page?
Hey Chris,
Thanks for the offer to help. Take a look at this page. This is the code I've used in my application as well. And it appears no geometry is symbolized in this example either.
I'm not totally following this example here: Display identify results in popup | ArcGIS API for JavaScript but it does highlight a parcel using the identify task. I just don't see how it selects. Any ideas Rene Rubalcava ?
I copied the code from that page and tested it out.
First thing I saw was that you are not returning geometry with the IdentifyResult.
identifyParams.returnGeometry = false;
I changed it to true.
Second thing I noticed was the results are not actually added to the map. They are saved to a cityResults and countyResults, but then nothing is done with them.
I don't know what logic you wanted for adding the graphic, so I just tweaked the code in a JSBin to do this.
JS Bin - Collaborative JavaScript Debugging
Hope that helps.
Thanks.
OK thank you both for your help. I've hesitated to share my application because frankly I have no experience coding in javascript and basically take the examples from the ESRI site and hammer them until I get them to operate as I need. However, as I mentioned, in the last couple days my application has stopped "highlighting" identified features. Seems strange and I'm at my wits end. Would you mind taking a look (take it easy on my obviously poor coding skills)?
I see the symbolization when I use the Map Search button, but not when I click on a building on the map. Looking at your code, I don't see the showResults (or showResults2) being called when you execute the IdentifyTask.
One other negligible thing...you call the "dijit/registry" module twice in your require line (with duplicate "registry" variables in the function). Also, why call "dojo/_base/connect" when you never use it?
Thanks for the note about dijit/registry
Even when I call showResults2 it doesn't render the geometry. I think I'm losing my mind.