AnsweredAssumed Answered

Help displaying Subtypes in Popup

Question asked by geonetadmin on Apr 18, 2013
Original User: janiceb

Is there anyway to get to the subtypes in a Map Service and display them in the Identify Popup for a feature? I have found them and am able to write them to the debug console but the type is showing up as null in the feature even though it has an integer that relates to the subtype. Features from the map service can be displayed by subtype value and the legend shows the subtype labels so it seems there must be a way to get them from the map service. I am hoping someone out there knows a way to do this before I write a bunch of code to solve the problem.

function executeIdentifyTask(evt) {
    var measureMode = dojo.query(".esriButton .dijitButtonNode").some(function (node, index, arr) {
        if (node.childNodes[0].checked) {
            //at least one of the measure tools is active so disable identify
            return true;
        }
    });
    if (!measureMode) {
        identifyParams.geometry = evt.mapPoint;
        identifyParams.mapExtent = map.extent;
        identifyParams.width = map.width;
        identifyParams.height = map.height;
        var oneStopLink = "";
        var tableStyle = "<table border='0' cellpadding='2' width='100%' align='center' cellspacing='2'>";
        var cellStyle = "<td bgcolor='#E0E0E0' align='left'>";
        var headerStyle = "<h1 style=color:#006699;font-size:16px>";
        var natureDesc = "<a href=./HTML/crimehelp.htm#7 target=_blank>${NatureDesc}</a>";
        var deferred = identifyTask.execute(identifyParams);
        deferred.addCallback(function (response) {
            if (response.length === 0) { console.debug("No Feature Found"); }
            //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;
                switch (result.layerName) {
                    case 'Historical Sites':
                        for (i=0; i<map._layers.layer1.legendResponse.layers[0].legend.length; i++){
                            console.debug("JSON: " + map._layers.layer1.legendResponse.layers[0].legend[i].label);
                        }
                        oneStopLink = "<a href=" + serverLink + "/HistoricalSociety/HTML/historicalsites/${HistoryID}.htm target=_new>Historical Society Information for ${Name}</a>";
                        feature.setInfoTemplate(new esri.InfoTemplate(
                            "Historical Sites",
                            headerStyle + "Historical Sites</strong></h1>"
                            + tableStyle
                            + "<tr>" + cellStyle + "<b>Type </b></td><td>${Type}</td></tr>"
                            + "<tr>" + cellStyle + "<b>Name </b></td><td>${Name}</td></tr></table><br/><br/>"
                            + "<table  border='0' align='center' width='306' cellpadding='2' cellspacing='2'>"
                            + "<tr><td  valign='top'><div align='right'><font face='Arial, Helvetica, sans-serif' size='2'>"
                            + "<img src='/HistoricalSociety/Images/HistoricalSites/${HistoryID}.jpg'></font></div></td></tr></table><br/><br/>"
                            + oneStopLink));
                        break;


Thanks,
Janice.

Attachments

Outcomes