Hi

I'm trying to use the GetFeaturesInfo request on a layer to get values in a
Popup. The response in the 
function setHTML(response), shows up black when alerted. I alerted the url
in the getfullrequeststring and that is working. But the pop-up values show
up as unknown.

I looked at my error log and the error it gives me is

msWMSFeatureInfo(): WMS server error. Layer(s) specified in QUERY_LAYERS
parameter is not offered by the service instance.

This is my javascript file.

function init(){
         
var options = {
    projection: new OpenLayers.Projection("EPSG:26915"),
    units: "m", 
    maxResolution: 7000,
    maxExtent:bounds,
    minExtent: new OpenLayers.Bounds(-1, -1, -1, -1),
    numZoomLevels: 22
  };

  map = new OpenLayers.Map('map', options);
  map.addControl(new OpenLayers.Control.LayerSwitcher());
  map.addControl(new
OpenLayers.Control.MousePosition({suffix:'                                          ',numDigits:3,displayProjection:proj}));
  map.addControl(new OpenLayers.Control.KeyboardDefaults());
 
  
  var usa = new OpenLayers.Layer.WMS.Untiled("",
"http://www.gis.leg.mn/cgi-bin/mapserv?map=/web/gis/OpenLayers/redistricting/mapserver.map";,
  {layers: 'usa2',transparent:true}, {opacity: 0.6, visibility:
true,isBaseLayer: false,wrapDateLine: true});
   var names = new OpenLayers.Layer.WMS.Untiled("Names",
"http://www.gis.leg.mn/cgi-bin/mapserv?map=/web/gis/OpenLayers/redistricting/mapserver.map";,
  {layers: 'statenames_short,statenames_long',transparent:true}, {opacity:
0.6, visibility: true,isBaseLayer: true,wrapDateLine: true});
  markers = new OpenLayers.Layer.Markers("My
Location",{displayInLayerSwitcher:false});
    

  map.addLayers([usa,names,markers]);
  
  
  infoControls = new OpenLayers.Control.WMSGetFeatureInfo({
    url:
'http://www.gis.leg.mn/cgi-bin/mapserv?map=/web/gis/OpenLayers/redistricting/mapserver.map',
 
    title: 'redistricting cases 03', 
    layers: [usa],
    hover: true,
    pixelTolerance: 50,
    formatOptions: {
            typeName: 'ST_ABB', 
            featureNS: 'http://www.gis.leg.mn/cgi-bin/mapserv?'
    },
    queryVisible: true, 
    eventlisteners: {
    getfeatureinfo: function(event) {
    map.addPopup (new OpenLayers.Popup.FrameCloud("PopUp", 
    getLonLatFromPixel(event.xy), 
    null, 
    event.text,
    null,
    true))
      }
     }
    }); 
    
    //alert (function(event));
    
    infoControls.events.register("getfeatureinfo", this, findLayerClick);
            map.addControl(infoControls); 
        

        infoControls.activate();
        map.zoomToExtent(bounds);
        
        
 function findLayerClick(event) {

    layerlist = "usa";

    mouseLoc = map.getLonLatFromPixel(event.xy);

    var url = usa.getFullRequestString({
                REQUEST: "GetFeatureInfo",
                EXCEPTIONS: "application/vnd.ogc.se_xml",
                BBOX: map.getExtent().toBBOX(),
                X: event.xy.x,
                Y: event.xy.y,
                INFO_FORMAT: 'text/html',
                QUERY_LAYERS: layerlist,
                FEATURE_COUNT: 1,
                WIDTH: map.size.w,
                HEIGHT: map.size.h},
               
"http://www.gis.leg.mn/cgi-bin/mapserv?map=/web/gis/OpenLayers/redistricting/mapserver.map";);

    OpenLayers.loadURL(url, '', this, setHTML);
    
    alert(url);
    
    

    Event.stop(event);
}

function setHTML(response) {
        alert(response.responseText);
    if (response.responseText.indexOf('no results') == -1) {
        var cat="Unknown", src="Unknown", leg="Unknown", linkinfo="";
        var lines = response.responseText.split('\n');
        for (lcv = 0; lcv < (lines.length); lcv++) {
            var vals =
lines[lcv].replace(/^\s*/,'').replace(/\s*$/,'').replace(/ =
/,"=").replace(/'/g,'').split('=');
            //alert (lines);
            if (vals[1] == "") {
                vals[1] = "Unknown";
            }
            if (vals[0].indexOf('ST_ABB') != -1 ) {
                cat = vals[1];
            } else if (vals[0].indexOf('ST_NAME') != -1 ) {
                src = vals[1];
            } else if (vals[0].indexOf('NAME') != -1 ) {
                leg = vals[1];
            } else if (vals[0].indexOf('COLOR') != -1 ) {
                linkinfo = vals[1];
            }
        }
        var popup_info="Project Name:<h5>" + cat +
                        "<br />Project Type:<br /> " + leg +
                        "<br />County:<br />" + src +
                        "<br /><br />  +linkinfo+  Click here for Report " +
                        "";
        if (popup != null) {
            popup.destroy();
            popup = null;
        }
        popup = new OpenLayers.Popup.FramedCloud("State Info",
                                        mouseLoc,
                                        new OpenLayers.Size(150,160),
                                        popup_info,
                                        null,
                                        true);
        popup.setBackgroundColor("#FFFFCC");
        popup.setBorder("2px");
//      popup.setOpacity(.7);
        map.addPopup(popup);
        popup.events.register("click", map, popupDestroy);
    }
}

/*
 * Destroy popup and stop event
 */
function popupDestroy(e) {
    popup.destroy();
    popup = null;
    OpenLayers.Util.safeStopPropagation(e);
}
  
document.getElementById('OpenLayers.Layer.WMS.Untiled_57').style.cursor="url(cursor.gif),crosshair";
};


my mapfile

MAP
  NAME 'redistricting case'
#  SIZE 600 450
        STATUS ON
        #MAXSIZE 4096
        UNITS METERS
        FONTSET         "/web/gis/mapserver/fonts/fontset.list"
        SYMBOLSET       "/web/gis/mapserver/symbols/symbol.sym"
        TRANSPARENT ON
        PROJECTION
       "proj=utm"
        "ellps=GRS80"
        "datum=NAD83"
        "zone=15"
        "units=m"
        "north"
        "no_defs"
END
    
        OUTPUTFORMAT
                NAME 'agg/png'
                DRIVER AGG/PNG
                IMAGEMODE RGBA
                FORMATOPTION "TRANSPARENT=TRUE"
        END 

#       OUTPUTFORMAT
#               NAME 'agg/jpeg'
#               DRIVER GD/JPEG
#               IMAGEMODE RGB
#               FORMATOPTION "TRANSPARENT=FALSE"
#       END

        # One day, when the death of IE6 is confirmed, I would love for this
        # to default to agg/png - Lee did just that
        IMAGETYPE AGG/PNG

        WEB
                METADATA
                        "wms_title"      "redistricting cases 03"
                        "wms_feature_info_mime_type" "text/html"
                        "wms_srs" "EPSG:26915"
                END

                TEMPLATE 'CaseSum03_template.html'
        END

LAYER
    NAME 'usa2'
    DATA '/geo/usa'
    STATUS ON
    DEBUG ON
    TYPE POLYGON
        METADATA
                wms_title "states"
                wms_srs   "EPSG:26915:"
                ows_include_items "all"
                
        END     
    TEMPLATE '/web/gis/OpenLayers/redistricting/casesum03_template.html'

    CLASSITEM 'color'
    CLASS
      NAME 'USA0'
      EXPRESSION '0'
      STYLE
        OUTLINECOLOR 115 115 115
        COLOR 141 211 199
        SIZE 4
      END
    END
    CLASS
      NAME 'USA1'
      EXPRESSION '1'
      STYLE
        OUTLINECOLOR 115 115 115
        COLOR 251 128 114
        SIZE 4
      END
    END
    CLASS
      NAME 'USA2'
      EXPRESSION '2'
      STYLE
        OUTLINECOLOR 115 115 115
        COLOR 190 186 218
        SIZE 4
      END
    END
    CLASS
      NAME 'USA3'
      EXPRESSION '3'
      STYLE
        OUTLINECOLOR 115 115 115
        COLOR 255 255 179
        SIZE 4
      END
    END
    CLASS
      NAME 'USA4'
      EXPRESSION '4'
      STYLE
        OUTLINECOLOR 115 115 115
        COLOR 128 177 211
        SIZE 4
      END
    END
        
  END

  LAYER
    NAME 'statenames_short'
    DATA '/geo/usa'
    STATUS on
    TYPE ANNOTATION
        MINSCALE 10000000
    LABELITEM 'ST_ABB'
        
    LABELCACHE ON
    CLASS
      LABEL
        SIZE MEDIUM
        MINSIZE 7
        MAXSIZE 10
        COLOR 70 70 70
        #OUTLINECOLOR 30 30 30
        TYPE TRUETYPE
        FONT arial-bold
        ANTIALIAS TRUE
        BUFFER 4
        PARTIALS FALSE              
      END
    END 
  END

LAYER
    NAME 'statenames_long'
    DATA '/geo/usa'
    STATUS DEFAULT
    TYPE ANNOTATION
    LABELITEM 'STATE'
    MAXSCALE 10000000
    CLASS
      LABEL
        SIZE MEDIUM
        MINSIZE 8
        MAXSIZE 10
        TYPE TRUETYPE
        FONT arial-bold
        ANTIALIAS TRUE
        BUFFER 4
        COLOR 115 115 115
        #OUTLINECOLOR 155 155 155
      END
    END
  END


Any ideas as to what might the problem be? Any help would be appreciated.

Thanks
N
-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Layer-s-specified-in-QUERY-LAYERS-parameter-is-not-offered-by-the-service-instance-tp5662901p5662901.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to