问题描述
我的是google地图引入<scriptsrc="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg"></script>
加载google地图vargoogleLayer=newOpenLayers.Layer.Google("google",{type:G_NORMAL_MAP,maxZoomLevel:18,Layers:'basic'});map.addLayers([googleLayer]);
当我点击地图的时候map.events.register('click',map,function(e){varparams={REQUEST:"GetFeatureInfo",EXCEPTIONS:"application/vnd.ogc.se_xml",BBOX:map.getExtent().toBBOX(),X:e.xy.x,Y:e.xy.y,INFO_FORMAT:'application/vnd.ogc.gml',QUERY_LAYERS:layers,FEATURE_COUNT:50,Srs:'EPSG:4326',Styles:'',WIDTH:map.size.w,HEIGHT:map.size.h,format:'image/png'};OpenLayers.loadURL(url,params,this,setHTML,setHTML);
里面的那个layers和url应该写什么啊?求解
解决方案
解决方案二:
layers应该写你加载的图层名称OpenLayers.loadURL("http://localhost:8080/geoserver/wangwei/wms",params,this,onComplete,onFailure)//定义请求成功响应函数functiononComplete(response){document.getElementById('click_response').innerHTML=response.responseText;alert(response.responseText);};//事件失败响应函数functiononFailure(response){document.getElementById('click_response').innerHTML=response.responseText;}
解决方案三:
url是的你数据源