I have a ArcGISDynamicMapServiceLayer ...I now want to be able to highlight (set the color) a polygon when it is clicked on.
dojo.connect(map, "onClick", executeQueryTask);
function executeQueryTask(evt) {
query.geometry = evt.mapPoint;
queryTask.execute(query, showResults);
}
function showResults(featureSet) {
dojo.forEach(featureSet.features,function(feature){
var graphic = feature;
graphic.setSymbol(symbol);
map.graphics.add(graphic);
});
}
query = new esri.tasks.Query();
query.returnGeometry = true;
query.outFields = ["*"];
queryTask = new esri.tasks.QueryTask("http://gis.chcity.org/CHwebMaps/rest/services/CityData/Parcels_SD/MapServer/0");
if I add the /0 at the place where I create and add my dynamic map service layer, my parcels layer does not load.
How do I go about making sure BOTH things happen on a click of the map?
dojo.connect(map, "onClick", function(evt) {
identifyLocation(evt.mapPoint, operationalLayers);
});
I get mixed up about what javascript I should add in the layout.js file and what should be added to index.html. For example, do I initialize the event listener, query task, query filter, and symbol properties in the init function of index.html, or in the initMap function of layout.js?
dojo.connect(map, "onClick", function(evt) {
identifyLocation(evt.mapPoint, operationalLayers); //1st function
executeQueryTask(evt); //2nd function
}