图层加载限制通过geoserver提供的图层组可以解决。
首先将图层分类。
我的图层分了4组图层组。
region组:
topp:bou2_4p,topp:shijie_region,topp:huposhuiku_region,topp:shuangxianhe_region,topp:lvdi_region,
topp:jumindi_region,topp:chengshijiequ_region,topp:jiaoqudiwu_region,topp:shiqudaolu_region,
topp:qitadaolu_region,topp:xianjie_region
polyline组:
topp:guihuadaolu_polyline,topp:gongyuanlu_polyline,topp:qitadaolu_polyline,topp:xiaolu_polyline,
topp:chengshijiequ_polyline,topp:shiqudaolu_polyline,topp:sijidaolu_polyline,topp:ccsanjidaolu_polyline,
topp:sanjidaolu_polyline,topp:erjidaolu_polyline,topp:yijidaolu_polyline,topp:huanchenglu_polyline,
topp:ccxianxiangdao_polyline,topp:xianxiangdao_polyline,topp:tielu_polyline,topp:guodao_polyline,
topp:shengdao_polyline,topp:zaijiangaosu_polyline,topp:gaosugonglu_polyline
point组:
topp:daolumingcheng_point,topp:xingzhengbiaoji_point,topp:jiaoqudiwu_font_point,
topp:jiaoqudiwu_point,topp:shiqudiwu_point,topp:qiao_point,topp:shanming_point
polyline组:(按功能把 水域 的图层分开了)
topp:suidao_polyline,topp:shuangxianhe_polyline,topp:huposhuiku_polyline,topp:danxianhe_polyline,
topp:chedu_polyline,topp:shuizhashuiba_polyline,topp:qiao_polyline,topp:ti_polyline
分完组后通过如下步骤增加图层组。
创建图层组名称:jilin
基础地理图层:topp:bou2_4p,topp:shijie_region,topp:huposhuiku_region,topp:shuangxianhe_region,topp:lvdi_region,
topp:jumindi_region,topp:chengshijiequ_region,topp:jiaoqudiwu_region,topp:shiqudaolu_region,
topp:qitadaolu_region,topp:xianjie_region
点击生成按钮。
依次添加图层组。
配置完毕后,页面访问可以通过如下访问了。
layer = new OpenLayers.Layer.WMS( "topp:shijie_region - Untiled", "http://localhost:8080/geoserver/wms", { width: '800', srs: 'EPSG:4326', layers:'jilin,shui,daolu,point', height: '560', styles: '', format: 'image/png' }, {singleTile: true, ratio: 1} );