rock well ha scritto:<br><br><div>Hi all i was wondering if there is an equivalent script for wms request for asp script with iis in the below link </div>
<div> </div>
<div><a href="http://ms.gis.umn.edu/docs/howto/wms_server">http://ms.gis.umn.edu/docs/howto/wms_server</a>,</div>
<div>i am trying to do the same thing in <a href="http://vb.net">vb.net</a> ....</div>
<div> </div>
<div>Any suggestions please .....</div>
<br><br>I do:<br><br>public Map getMap(string queryString)<br> {<br> string mapImgUrl = null;<br> string mapwidth = null;<br> string mapheight = null;<br> string scalebar = null;
<br> string imgxy = null; //[center] of the image<br> string imgext = null;<br> string legend = null;<br> string referenceMap = null;<br> <br> Map map = null; //holds all map value
<br> <br> <br> try {<br> <br> HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(queryString);<br> <br> webRequest.Timeout=10000
;<br> webRequest.Method = "GET";<br> // Send the WebRequest and read response<br> HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();<br> Stream sResponse =
webResponse.GetResponseStream();<br> StreamReader reader = new StreamReader(sResponse);<br> <br> //first line is additional info from MapServer<br> string header =
reader.ReadLine();<br> <br> if(header == "<HTML>") { //error<br> string message = reader.ReadToEnd();<br> message += "\n\n\"" + header + message + "\"\n\n";
<br> throw new Exception(message);<br> }<br> <br> //actual parameters<br> XmlDocument xmldoc = new XmlDocument();<br> string doc =
reader.ReadToEnd();<br> xmldoc.LoadXml(doc);<br> xmldoc.PreserveWhitespace = true;<br> XmlNode root = xmldoc.DocumentElement;<br> <br> mapImgUrl =
root.SelectSingleNode("img").Attributes["value"].Value;<br> mapwidth = root.SelectSingleNode("mapwidth").Attributes["value"].Value;<br> mapheight = root.SelectSingleNode
("mapheight").Attributes["value"].Value;<br> scalebar = root.SelectSingleNode("scalebar").Attributes["value"].Value;<br> imgxy = root.SelectSingleNode("imgxy").Attributes["value"].Value;
<br> imgext = root.SelectSingleNode("imgext").Attributes["value"].Value;<br> referenceMap = root.SelectSingleNode("referenceMap").Attributes["value"].Value;
<br> legend = root.SelectSingleNode("legend").InnerText;<br> <br> sResponse.Close();<br> reader.Close();<br> webResponse.Close();<br>
<br> map = new Map(mapImgUrl, mapwidth, mapheight, scalebar, imgxy, imgext, legend, referenceMap);<br> <br> sResponse.Close();<br> reader.Close();<br>
webResponse.Close();<br> <br> } catch (Exception ex) {<br> throw new Exception("queryString:"+queryString+"\n"+ex.StackTrace);<br> }<br> <br>
return map;<br> <br> } //method<br><br>web_template.xml:<br><br><?xml version="1.0" encoding="utf-8" ?><br><map><br> <img value="[img]"/><br> <mapwidth value="[mapwidth]"/>
<br> <mapheight value="[mapheight]"/><br> <scalebar value="[scalebar]"/><br> <referenceMap value="[ref]"/><br> <imgxy value="[center]"/><br> <imgext value="[mapext]"/>
<br> <legend> <br> <![CDATA[<br> [legend]<br> ]]><br> </legend><br></map><br><br><br><br>[Serializable]<br> public class Map<br> {<br> <br> public string mapImgUrl = "";
<br> public string mapwidth = "";<br> public string mapheight = ""; <br> public string scalebar = ""; <br> public string imgxy = ""; <br> public string imgext = "";
<br> public string legend = ""; <br> public string referenceMap = "";<br> <br> public Map(string mapImgUrl, string mapwidth, string mapheight, string scalebar, string imgxy, string imgext, string legend, string referenceMap)
<br> {<br> this.mapImgUrl = mapImgUrl;<br> this.mapwidth = mapwidth;<br> this.mapheight = mapheight;<br> this.scalebar = scalebar;<br> this.imgxy = imgxy;<br>
this.imgext = imgext;<br> this.legend = legend;<br> this.referenceMap = referenceMap;<br> }<br> }<br><br>How u do the call depends if u use postbacks or ajax. If ajax, wrap the method with ajax serverside call, and then do javascript call to that method (this depends on ajax library used, I used AjaxPro).
<br>If postbacks, u do the work in PageLoad. Take posted parameters from user interface, build the url, call the method above (or similar...), then u can use returned values (image url, extension ecc.) in the Page with classic asp style: <image src="<%= mapUrl%>" /> ecc.
<br><br>Ciao<br> Piero<br><br>