[OpenLayers-Users] Opemlayers.loadURL() does not work in GetFeatureInfo

Sarah Schuessler sarah_flip at yahoo.de
Tue Mar 30 02:54:01 EDT 2010


Hi,

only thing I´ve noticed fast scanning through your code:
have you tried setting layer1.map.size.w instead of map.size.w?
And have you tried changing INFO_FORMAT?

best regards
Sarah




________________________________
Von: sunny74 <sb.ray at hotmail.com>
An: users at openlayers.org
Gesendet: Dienstag, den 30. März 2010, 8:22:20 Uhr
Betreff: [OpenLayers-Users] Opemlayers.loadURL() does not work in GetFeatureInfo


Dear Friends,

OpenLayers.loadUrl(url, '', this, setHTML);
does not work when I do a GetFeatureInfo call in an aspx page.

It says Jscript does not support this object or property.
My map file is Ok as I get to see the map properly.
Does anybody know how to solve this problem.

My code in aspx page is:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs"
Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script   type="text/javascript"
src="OL28/OL28/lib/OpenLayers.js"></script>
    <script type="text/javascript">
        var mapview, layer, layer1, map;

        function init2() {
          

        }

      
    
  
  
  
  
  
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="map" runat="server" style="width:600px;height:600px">
    <script defer="defer" type="text/javascript">
        OpenLayers.ProxyHost =
"http://172.16.0.144:9000/cgi-bin/proxy.cgi?url=";
        //alert('here');
        var lon = 73.25;
        var lat = 20.35;
        var zoom = 6;
        map = new OpenLayers.Map('<%=map.ClientID%>');
        //            layer = new OpenLayers.Layer.WMS("OpenLayers WMS",
        //                "http://localhost:9000/cgi-bin/mapserv.exe?", {
map: '../htdocs/Shape/newwr1rec.map', layers: 'STATE', format: 'png' });
        //            layer1 = new OpenLayers.Layer.WMS("Rstations",
        //                "http://localhost:9000/cgi-bin/mapserv.exe?", {
map: '../htdocs/Shape/newwr1rec.map', transparent: true, layers:
'RailwayStations', format: 'png' });
        //alert(map);
        layer = new OpenLayers.Layer.WMS("OpenLayers WMS",
"http://172.16.0.144:9000/cgi-bin/mapserv.exe?map=d:/ms4w/apache/htdocs/Shape/newwr1rec.map",
{ 'layers': 'STATE', transparent: false, format: "image/png" });
        layer1 = new OpenLayers.Layer.WMS("OpenLayers WMS",
"http://172.16.0.144:9000/cgi-bin/mapserv.exe?map=d:/ms4w/apache/htdocs/Shape/newwr1rec.map",
{ 'layers': 'RailwayStations', transparent: true, format: "image/png" });
        //alert(layer);
        map.addLayers([layer, layer1]);

        //layer = new OpenLayers.Layer.WFS("OpenLayers WFS",
"http://127.0.0.1:9000/cgi-bin/mapserv.exe?map=d:/ms4w/apache/htdocs/Shape/newwr1.map",
{ typename: 'STATE', maxfeatures: 6 }, { featureClass:
OpenLayers.Feature.WFS });

        ///map.addLayer(layer);


        map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
        map.addControl(new OpenLayers.Control.LayerSwitcher());
        //map.zoomToMaxExtent();
        map.events.register('click', map, function(e) {
            //alert('clicked');
            OpenLayers.Util.getElement('nodeList').innerHTML = "Loading...
please wait...";
            var url = layer1.getFullRequestString({
                REQUEST: "GetFeatureInfo",
                EXCEPTIONS: "application/vnd.ogc.se_xml",
                BBOX: layer1.map.getExtent().toBBOX(),
                X: e.xy.x,
                Y: e.xy.y,
                INFO_FORMAT: 'text/html',
                QUERY_LAYERS: layer1.params.LAYERS,
                
                FEATURE_COUNT: 1,
                WIDTH: map.size.w,
                HEIGHT: map.size.h
            });
            //  var msg = document.getElementById('urlmsg');
            //  msg.value = url;
            alert(url, "getfeatureinfo",
"location=0,status=0,scrollbars=1,width=800,height=400");
            //window.open(url, '', this, setHTML, setHTML);
            OpenLayers.loadUrl(url, '', this, setHTML);
            OpenLayers.Event.stop(e);
        });


        function setHTML(response) {
            OpenLayers.Util.getElement('nodeList').innerHTML =
response.responseText;
        }
  
  
  
  
    </script>
    </div>
    <div id="nodelist">
  
    </div>
    </form>
</body>
</html>



Thanks for attention and efforts.
-- 
View this message in context: http://n2.nabble.com/Opemlayers-loadURL-does-not-work-in-GetFeatureInfo-tp4822969p4822969.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users


__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100330/9285087b/attachment.html


More information about the Users mailing list