function mapReady(map){ on(map,"Click",executeIdentifyTask); //create identify tasks and setup parameters identifyTask = new esri.tasks.IdentifyTask("http://nmbbmapping.org/arcgis/rest/services/casa/MapServer/"); identifyParams = new esri.tasks.IdentifyParameters(); identifyParams.tolerance = 10; identifyParams.returnGeometry = true; identifyParams.layerIds = [1,16]; identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL; identifyParams.width = map.width; identifyParams.height = map.height; } function executeIdentifyTask(evt) { identifyParams.geometry = evt.mapPoint; identifyParams.mapExtent = map.extent; var deferred = identifyTask.execute(identifyParams); deferred.addCallback(function(response) { // response is an array of identify result objects // Let's return an array of features. return dojo.map(response, function(result) { var feature = result.feature; feature.attributes.layerName = result.layerName; if(result.layerName === 'Public Schools K12'){ //console.log(feature.attributes.PARCELID); var template = new PopupTemplate ({ title: "Public Schools K12", //description: , fieldInfos: [{ // define field infos to specify alias fieldName: "INST_NAME", visible: true, label: "Institution Name: " }, { fieldName: "ADDRESS", visible: true, label: "Address: " }, { fieldName: "CITY", visible: true, label: "City: " }] }); feature.setInfoTemplate(template); } else if (result.layerName === 'Non Government Community Support'){ //console.log(feature.attributes.PARCELID); var template = new PopupTemplate ({ title: "Non Government Community Support", //description: , fieldInfos: [{ // define field infos to specify alias fieldName: "INST_NAME", visible: true, label: "Institution Name: " }, { fieldName: "ADDRESS", visible: true, label: "Address: " }, { fieldName: "CITY", visible: true, label: "City: " }] }); feature.setInfoTemplate(template); } return feature; }); }); map.infoWindow.setFeatures([ deferred ]); map.infoWindow.show(evt.mapPoint); }
Solved! Go to Solution.
if (result.layerName === 'Public Schools K12') { //console.log(feature.attributes.PARCELID); var template = new PopupTemplate({ title: "Public Schools K12", //description: , fieldInfos: [{ // define field infos to specify alias fieldName: "INST_NAME", visible: true, label: "Name: " }, { fieldName: "ADDRESS", visible: true, label: "ADDRESS: " }, { fieldName: "CITY", visible: true, label: "CITY: " }] });
if (result.layerName === 'Public Schools K12') { //console.log(feature.attributes.PARCELID); var template = new PopupTemplate({ title: "Public Schools K12", //description: , fieldInfos: [{ // define field infos to specify alias fieldName: "Name of the Institution", visible: true, label: "Name: " }, { fieldName: "Address", visible: true, label: "ADDRESS: " }, { fieldName: "City", visible: true, label: "CITY: " }] });
if (result.layerName === 'Public Schools K12') { //console.log(feature.attributes.PARCELID); var template = new PopupTemplate({ title: "Public Schools K12", //description: , fieldInfos: [{ // define field infos to specify alias fieldName: "INST_NAME", visible: true, label: "Name: " }, { fieldName: "ADDRESS", visible: true, label: "ADDRESS: " }, { fieldName: "CITY", visible: true, label: "CITY: " }] });
if (result.layerName === 'Public Schools K12') { //console.log(feature.attributes.PARCELID); var template = new PopupTemplate({ title: "Public Schools K12", //description: , fieldInfos: [{ // define field infos to specify alias fieldName: "Name of the Institution", visible: true, label: "Name: " }, { fieldName: "Address", visible: true, label: "ADDRESS: " }, { fieldName: "City", visible: true, label: "CITY: " }] });