varmap,layer;functioninit(){map=newOpenLayers.Map('map');map.addControl(newOpenLayers.Con"/> varmap,layer;functioninit(){m"/>
首页 > Openlayers加载wms

Openlayers加载wms

2018-07-18 6页 doc 13KB 39阅读

用户头像

is_598372

暂无简介

举报
Openlayers加载wmsOpenLayers。OpenLayers的资料,网上已经有很多例子了。我这里想说的是如何高效的使用我们在访问WMS的时候,一般不会只请求一个图层,有可能会是很多图层。我刚开始使用OpenLayers的时候,是这样使用的:viewplaincopytoclipboardprint?vscripttype="text/javascript">varmap,layer;functioninit(){map=newOpenLayers.Map('map');map.addControl(newOpenLayers.Control.L...
Openlayers加载wms
OpenLayers。OpenLayers的资料,网上已经有很多例子了。我这里想说的是如何高效的使用我们在访问WMS的时候,一般不会只请求一个图层,有可能会是很多图层。我刚开始使用OpenLayers的时候,是这样使用的:viewplaincopytoclipboardprint?vscripttype="text/javascript">varmap,layer;functioninit(){map=newOpenLayers.Map('map');map.addControl(newOpenLayers.Control.LayerSwitcher());newvarbounds=OpenLayers.Bounds(103.94971885,30.5749127,104.18353815,30.7504793);layerblock=newOpenLayers.Layer.WMS("topp:Block_region","HYPERLINK"http://localhost:8989/geoserver/wms"http://localhost:8989/geoserver/wms",{layers:'topp:Block_region',srs:'EPSG:4326',style:'',format:'image/png',tiled:'true'//transparent:false},{maxExtent:bounds,//maxResolution:0.0041261434555042165,projection:'EPSG:4326',buffer:0,reproject:true,//opacity:0.8,isBaseLayer:true});layerpublic=newOpenLayers.Layer.WMS("topp:PUBLIC_region","HYPERLINK"http://localhost:8989/geoserver/wms"http://localhost:8989/geoserver/wms",{layers:'topp:PUBLIC_region',srs:'EPSG:4326',style:'',//format:'image/png',tiled:'true',transparent:true},{maxExtent:bounds,//maxResolution:0.0041261434555042165,projection:'EPSG:4326',buffer:0,reproject:true,//opacity:0.8,isBaseLayer:true});layerroad=newOpenLayers.Layer.WMS("topp:Road_Regular_polyline","HYPERLINK"http://localhost:8989/geoserver/wms"http://localhost:8989/geoserver/wms",{layers:'topp:Road_Regular_polyline',srs:'EPSG:4326',style:'',//format:'image/png',tiled:'true',transparent:true},{maxExtent:bounds,//maxResolution:0.0041261434555042165,projection:'EPSG:4326',buffer:0,reproject:true,//opacity:0.8,isBaseLayer:true});map.addLayers([layerblock,layerpublic,layerroad]);map.zoomToExtent(bounds);}varmap,layer;functioninit(){map=newOpenLayers.Map('map');map.addControl(newOpenLayers.Control.LayerSwitcher());varbounds=newOpenLayers.Bounds(103.94971885,30.5749127,104.18353815,30.7504793);layerblock=newOpenLayers.Layer.WMS("topp:Block_region","HYPERLINK"http://localhost:8989/geoserver/wms"http://localhost:8989/geoserver/wms",{layers:'topp:Block_region',srs:'EPSG:4326',style:'',format:'image/png',tiled:'true'//transparent:false},{maxExtent:bounds,//maxResolution:0.0041261434555042165,projection:'EPSG:4326',buffer:0,reproject:true,//opacity:0.8,isBaseLayer:true});layerpublic=newOpenLayers.Layer.WMS("topp:PUBLIC_region","HYPERLINK"http://localhost:8989/geoserver/wms"http://localhost:8989/geoserver/wms",{layers:'topp:PUBLIC_region',srs:'EPSG:4326',style:'',//format:'image/png',tiled:'true',transparent:true},maxExtent:bounds.//maxResolution:0.0041261434555042165,projection:'EPSG:4326',buffer:0,reproject:true,//opacity:0.8,isBaseLayer:true});layerroad=newOpenLayers.Layer.WMS("topp:Road_Regular_polyline","HYPERLINK"http://localhost:8989/geoserver/wms"http://localhost:8989/geoserver/wms",{layers:'topp:Road_Regular_polyline',srs:'EPSG:4326',style:'',//format:'image/png',tiled:'true',transparent:true},{maxExtent:bounds,//maxResolution:0.0041261434555042165,projection:'EPSG:4326',buffer:0,reproject:true,//opacity:0.8,isBaseLayer:true});map.addLayers([layerblock,layerpublic,layerroad]);map.zoomToExtent(bounds);}viewplaincopytoclipboardprint?但是,我发现这样访问的速度极其的慢。然后,又把这个例子改造成以下的样子,发现,速度提高很多。但是,我发现这样访问的速度极其的慢。然后,又把这个例子改造成以下的样子,发现,速度提高很多。viewplaincopytoclipboardprint?varmap,layer;functioninit(){map=newOpenLayers.Map('map');newmap.addControl(newOpenLayers.Control.LayerSwitcher());varbounds=OpenLayers.Bounds(103.94971885,30.5749127,104.18353815,30.7504793);layerpublic=newOpenLayers.Layer.WMS("region","HYPERLINK"http://localhost:8989/geoserver/wms"http://localhost:8989/geoserver/wms",layers:'topp:Block_region,topp:PUBLIC_region,topp:Road_Regular_polyline',srs:'EPSG:4326',style:'',format:'image/png',tiled:'false',transparent:false},{maxExtent:bounds,//maxResolution:0.0041261434555042165,projection:'EPSG:4326',buffer:0,reproject:true,//opacity:0.5,isBaseLayer:true});map.addLayer(layerpublic);map.zoomToExtent(bounds);}viewplaincopytoclipboardprint?varmap,layer;functioninit(){map=newOpenLayers.Map('map');map.addControl(newOpenLayers.Control.LayerSwitcher());varbounds=newOpenLayers.Bounds(103.94971885,30.5749127,104.18353815,30.7504793);layerpublic=newOpenLayers.Layer.WMS("HYPERLINK"http://localhost:8989/geoserver/wms"http://localhost:8989/geoserver/wms",{'topp:Block_region,topp:PUBLIC_region,topp:Road_Regular_polyline',srs:'EPSG:4326',tiled:'false',{0.0041261434555042165,buffer:0,isBaseLayer:truemap.addLayer(layerpublic);new"region",layers:style:'',transparent:falsemaxExtent:bounds,reproject:true,map.zoomToExtent(bounds);'image/png',},//maxResolution:'EPSG:4326',//opacity:0.5,);format:projection:varmap,layer;functioninit(){map=newOpenLayers.Map('map');map.addControl(newOpenLayers.Control.LayerSwitcher());varbounds=newOpenLayers.Bounds(103.94971885,30.5749127,104.18353815,30.7504793);layerpublic=newOpenLayers.Layer.WMS("region","HYPERLINK"http://localhost:8989/geoserver/wms"http://localhost:8989/geoserver/wms",{layers:'topp:Block_region,topp:PUBLIC_region,topp:Road_Regular_polyline',srs:'EPSG:4326',style:'',format:'image/png',tiled:'false',transparent:false},{maxExtent:bounds,//maxResolution:0.0041261434555042165,projection:'EPSG:4326',buffer:0,reproject:true,//opacity:0.5,isBaseLayer:true});map.addLayer(layerpublic);map.zoomToExtent(bounds);}F面的只请求WMS服务。viewplaincopytoclipboardprint?这样看,就明白了,最上面的是请求了三个WMS服务,了一个WMS服务。这样看,就明白了,最上面的是请求了三个WMS服务,下面的只请求了一个viewplaincopytoclipboardprint?出处:飞(www.firnow.com):HYPERLINK"http://dev.firnow.com/course/1_web/webjs/20100721/480868.html"http://dev.firnow.com/course/1_web/webjs/20100721/480868.html
/
本文档为【Openlayers加载wms】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索