<div dir="ltr">Dear All:<br>I have a problem on building getFeatureinfo. I have use
Geoserver 1.6.4, and Tilecache. I pointed my geoserver sample page to
my tilecache. then I still want getfeatureinfo function of Geoserver. I
try to modified it, but not success. <br>
<br><pre> var map;<br> var testlayer;<br> var tiled;<br> function setHTML(response) { <br> document.getElementById('nodelist').innerHTML = response.responseText;<br><br> };<br>
<br> OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;<br> OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;<br> <br> function init(){<br> var bounds = new OpenLayers.Bounds(<br> 143.83482400000003, -43.648056,<br>
<br> 148.47914100000003, -39.573891<br> );<br> var options = {<br> controls: [],<br> maxExtent: bounds,<br> maxResolution: 0.018141863281250004,<br>
<br> projection: "EPSG:4326",<br> units: 'degrees'<br> };<br> map = new OpenLayers.Map('map', options);<br> <br> <br> // setup tiled layer<br>
<br> tiled = new OpenLayers.Layer.WMS(<br> "Geoserver layers - Tiled", "<a href="http://127.0.0.1:2010/tilecache/tilecache.py" target="_blank">http://127.0.0.1:2010/tilecache/tilecache.py</a>",<br>
<br> {<br> layers: 'tasmania',<br> styles: '',<br> height: '658',<br> width: '800',<br> srs: 'EPSG:4326',<br>
<br> format: 'image/png',<br> tiled: 'true',<br> tilesOrigin : "143.83482400000003,-43.648056"<br> },<br> {buffer: 0} <br>
<br> );<br> <br><br> <br> map.addLayer( tiled);<br> <br> // setup controls and initial zooms<br> map.addControl(new OpenLayers.Control.PanZoomBar());<br>
<br> map.addControl(new OpenLayers.Control.Navigation());<br> map.addControl(new OpenLayers.Control.Scale($('scale')));<br> map.addControl(new OpenLayers.Control.MousePosition({element: $('location')}));<br>
<br> map.addControl(new OpenLayers.Control.LayerSwitcher());<br> //map.addControl(new OpenLayers.Control.OverviewMap());<br> map.zoomToExtent(bounds);<br><br> testlayer = new OpenLayers.Layer.WMS(<br>
<br> "Geoserver layers - Untiled", "<a href="http://127.0.0.1:2008/geoserver/wms" target="_blank">http://127.0.0.1:2008/geoserver/wms</a>",<br> {<br> layers: 'tasmania',<br>
<br> styles: '',<br> height: '658',<br> width: '800',<br> srs: 'EPSG:4326',<br> format: 'image/png'<br>
<br> },<br> {singleTile: true, ratio: 1} <br> );<br>// here I would like to add stuff like this<br>//then geoserver only contain one layer, which is testlayer<br> var geoserver = map;<br>
<br> geoserver.addLayer(testlayer);<br> <br> <br> // support GetFeatureInfo<br> geoserver.events.register('click', geoserver, function (e) {<br> document.getElementById('nodelist').innerHTML = "Loading... please wait...";<br>
<br> var url = geoserver.layers[0].getFullRequestString(<br> {<br> REQUEST: "GetFeatureInfo",<br> EXCEPTIONS: "application/vnd.ogc.se_xml",<br>
<br> BBOX: geoserver.getExtent().toBBOX(),<br> X: e.xy.x,<br> Y: e.xy.y,<br> INFO_FORMAT: 'text/html',<br> QUERY_LAYERS: geoserver.layers[0].params.LAYERS,<br>
<br> FEATURE_COUNT: 50,<br> WIDTH: geoserver.size.w,<br> HEIGHT: geoserver.size.h<br> },<br> "<a href="http://127.0.0.1:2008/geoserver/wms" target="_blank">http://127.0.0.1:2008/geoserver/wms</a>"<br>
<br> );<br> OpenLayers.loadURL(url, '', this, setHTML, setHTML);<br> OpenLayers.Event.stop(e);<br> });<br> }<br><br><br>b</pre>because
I am not a JavaScript expert. it is hard for me to replace the layer,
such as map.layers[0]. how can use tilecache as base layer, and have
getFeatureInfo on top of it at same time? <br>
Much much thanks <br><br>all the best <br><br>Xiaoyu<br>PS, I have already send a copy to Geoserver mailling list<br clear="all"><br>-- <br>Xiaoyu Guan (Sam)<br>Geo-information Science<br>Wageningen UR<br><br>
</div>