<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-15">
<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px">
<DIV>Why have you got FORMAT: 'png' for a GetFeatureInfo request in your click event?</DIV>
<DIV> </DIV>
<DIV>I think you should work on getting a GetFeatureInfo request that works from your browser URL directly with Mapserver. Once you have the correct URL and a correct response from Mapserver, then you can work on implementing in OL.</DIV>
<DIV> </DIV>
<DIV>regards,</DIV>
<DIV> </DIV>
<DIV>Robert</DIV>
<DIV><BR>>>> sunny74 <sb.ray@hotmail.com> 24/03/2010 3:00 a.m. >>><BR><BR>Hi Bwoodall,<BR><BR>That example doesn't work.<BR>I am using the GetfeatureInfo example of OL27.<BR><BR>My code is as follows:<BR><BR><BR><script type="text/javascript" language="javascript"><BR> var mapview, layer, layer1, map,base;<BR><BR> OpenLayers.ProxyHost = "OL27/examples/proxy.cgi?url=";<BR>// var map = new OpenLayers.Map('map', );<BR> function init() {<BR><BR> //alert("in init");<BR> map = new OpenLayers.Map('<%=map.ClientID%>',{<BR>'maxResolution': 'auto' });<BR><BR> //<BR> layer = new OpenLayers.Layer.WMS("OpenLayers WMS",<BR> "http://172.16.0.144:9000/cgi-bin/mapserv.exe?", { map:<BR>'Shape/newwr1.map', layers: 'STATE', 'format': 'png' });<BR><BR> layer1 = new OpenLayers.Layer.WMS("BASIC",<BR> "http://172.16.0.144:9000/cgi-bin/mapserv.exe?", { map:<BR>'Shape/newwr1.map', transparent: 'true', layers: 'RailwayStations',<BR>'format': 'png' });<BR> // base = new OpenLayers.Layer.WMS("Base",<BR>"http://172.16.0.144:9000/cgi-bin/mapserv?map=Shape/newwr1.map", { layers:<BR>["state"] });<BR> base = new OpenLayers.Layer.WMS("Base",<BR>"http://mapsvr/cgi-bin/mapserv.exe?map=Shape/newwr1.map", { layers:<BR>["STATE"] });<BR><BR>// var wms = new OpenLayers.Layer.WMS("OpenLayers WMS",<BR> // <BR>"http://world.freemap.in/cgi-bin/mapserv?map=/www/freemap.in/world/map/factbook.map",<BR>{ 'layers': 'factbook' });<BR> <BR> map.addLayers([layer, layer1,base]);<BR> map.zoomToMaxExtent();<BR> map.setCenter(new OpenLayers.LonLat(73.25, 20.35), 6);<BR><BR> map.events.register('click', map, function(e) {<BR> alert('clicked');<BR> OpenLayers.Util.getElement('nodeList').innerHTML =<BR>"Loading... please wait...";<BR> var url = base.getFullRequestString({<BR> REQUEST: "GetFeatureInfo",<BR> EXCEPTIONS: "application/vnd.ogc.se_xml",<BR> FORMAT: 'png',<BR> BBOX: map.getExtent().toBBOX(),<BR> X: e.xy.x,<BR> Y: e.xy.y,<BR> INFO_FORMAT: 'text/plain',<BR> EPSG: 4326,<BR> QUERY_LAYERS: "STATE",<BR> FEATURE_COUNT: 6,<BR> WIDTH: map.size.w,<BR> HEIGHT: map.size.h<BR> });<BR> // var msg = document.getElementById('urlmsg');<BR> // msg.value = url;<BR> alert(url);<BR> OpenLayers.loadURL(url, '', this, setHTML);<BR> OpenLayers.Event.stop(e);<BR> });<BR> <BR> }<BR><BR> function setHTML(response) {<BR> OpenLayers.Util.getElement('nodeList').innerHTML =<BR>response.responseText;<BR> }<BR><BR><BR> <BR> <BR> </script><BR><BR>But again this is throwing error:<BR><BR>#!/usr/bin/env python """This is a blind proxy that we use to get around<BR>browser restrictions that prevent the Javascript from loading pages not on<BR>the same server as the Javascript. This has several problems: it's less<BR>efficient, it might break some sites, and it's a security risk because<BR>people can use this proxy to browse the web and possibly do bad stuff with<BR>it. It only loads pages via http and https, but it can load any content<BR>type. It supports GET and POST requests.""" import urllib2 import cgi import<BR>sys, os # Designed to prevent Open Proxy type stuff. allowedHosts =<BR>['www.openlayers.org', 'openlayers.org', 'labs.metacarta.com',<BR>'world.freemap.in', 'prototype.openmnnd.org', 'geo.openplans.org',<BR>'sigma.openplans.org', 'www.openstreetmap.org'] method =<BR>os.environ["REQUEST_METHOD"] if method == "POST": qs =<BR>os.environ["QUERY_STRING"] d = cgi.parse_qs(qs) if d.has_key("url"): url =<BR>d["url"][0] else: url = "http://www.openlayers.org" else: fs =<BR>cgi.FieldStorage() url = fs.getvalue('url', "http://www.openlayers.org")<BR>try: host = url.split("/")[2] if allowedHosts and not host in allowedHosts:<BR>print "Status: 502 Bad Gateway" print "Content-Type: text/plain" print print<BR>"This proxy does not allow you to access that location (%s)." % (host,)<BR>print print os.environ elif url.startswith("http://") or<BR>url.startswith("https://"): if method == "POST": length =<BR>int(os.environ["CONTENT_LENGTH"]) headers = {"Content-Type":<BR>os.environ["CONTENT_TYPE"]} body = sys.stdin.read(length) r =<BR>urllib2.Request(url, body, headers) y = urllib2.urlopen(r) else: y =<BR>urllib2.urlopen(url) # print content type header i = y.info() if<BR>i.has_key("Content-Type"): print "Content-Type: %s" % (i["Content-Type"])<BR>else: print "Content-Type: text/plain" print print y.read() y.close() else:<BR>print "Content-Type: text/plain" print print "Illegal request." except<BR>Exception, E: print "Status: 500 Unexpected Error" print "Content-Type:<BR>text/plain" print print "Some unexpected error occurred. Error text was:", E <BR><BR>Why are these erors comin?<BR>How to solve?<BR><BR>thanks.<BR>-- <BR>View this message in context: <A href="http://n2.nabble.com/getting">http://n2.nabble.com/getting</A>-Feature-Info-data-directly-from-shp-files-tp4767879p4783758.html<BR>Sent from the OpenLayers Users mailing list archive at Nabble.com.<BR>_______________________________________________<BR>Users mailing list<BR>Users@openlayers.org<BR><A href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</A><BR><BR></DIV><br><br><table bgcolor=white style="color:black"><tr><td><br>------------------------------------------------------------------<br>
The contents of this email are confidential to AsureQuality. If you have received this communication in error please notify the sender immediately and delete the message and any attachments. The opinions expressed in this email are not necessarily those of AsureQuality. This message has been scanned for known viruses before delivery. AsureQuality supports the Unsolicited Electronic Messages Act 2007. If you do not wish to receive similar communications in future, please notify the sender of this message.<br>
------------------------------------------------------------------</td></tr></table><br><br>
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">This message has been scanned for malware by SurfControl plc. </FONT><A href="http://www.surfcontrol.com/"><FONT style="BACKGROUND-COLOR: #ffffff" color=#000000>www.surfcontrol.com</FONT></A></P>
</body></HTML>