Openlayers加载wms.docx

上传人:b****8 文档编号:11913151 上传时间:2023-06-03 格式:DOCX 页数:13 大小:15.43KB
下载 相关 举报
Openlayers加载wms.docx_第1页
第1页 / 共13页
Openlayers加载wms.docx_第2页
第2页 / 共13页
Openlayers加载wms.docx_第3页
第3页 / 共13页
Openlayers加载wms.docx_第4页
第4页 / 共13页
Openlayers加载wms.docx_第5页
第5页 / 共13页
Openlayers加载wms.docx_第6页
第6页 / 共13页
Openlayers加载wms.docx_第7页
第7页 / 共13页
Openlayers加载wms.docx_第8页
第8页 / 共13页
Openlayers加载wms.docx_第9页
第9页 / 共13页
Openlayers加载wms.docx_第10页
第10页 / 共13页
Openlayers加载wms.docx_第11页
第11页 / 共13页
Openlayers加载wms.docx_第12页
第12页 / 共13页
Openlayers加载wms.docx_第13页
第13页 / 共13页
亲,该文档总共13页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

Openlayers加载wms.docx

《Openlayers加载wms.docx》由会员分享,可在线阅读,更多相关《Openlayers加载wms.docx(13页珍藏版)》请在冰点文库上搜索。

Openlayers加载wms.docx

Openlayers加载wms

OpenLayers的资料,网上已经有很多例子了。

我这里想说的是如何高效的使用OpenLayers。

我们在访问WMS的时候,一般不会只请求一个图层,有可能会是很多图层。

我刚开始使用OpenLayers的时候,是这样使用的:

viewplaincopytoclipboardprint?

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",

"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",

"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",

"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",

"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",

"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",

"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');

map.addControl(newOpenLayers.Control.LayerSwitcher());

varbounds=newOpenLayers.Bounds(103.94971885,30.5749127,104.18353815,30.7504793);

layerpublic=newOpenLayers.Layer.WMS("region",

"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("region","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);}

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",

"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?

这样看,就明白了,最上面的是请求了三个WMS服务,下面的只请求了一个WMS服务。

这样看,就明白了,最上面的是请求了三个WMS服务,下面的只请求了一个WMS服务。

viewplaincopytoclipboardprint?

文章出处:

飞诺网():

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 法律文书 > 调解书

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2