OpenLayers(Layer1)

4 개의 그림 층 을 추가 합 니 다.각 그림 층 의 속성 설정 에 주의 하 십시오:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>           </title>
<script type="text/javascript" src="code/OpenLayers.js"></script>
</head>

<body onLoad="init()">
<div id="map_element" style="width:500px; height:500px">
</div>
<script type="text/javascript">
	var map; 
	var wms_base;
	function init(){
		map=new OpenLayers.Map('map_element',{});
		wms_base=new OpenLayers.Layer.WMS(
			'Base Layer',
			'http://vmap0.tiles.osgeo.org/wms/vmap0',
			{layers:'basic'},
			{isBaseLayer:true}
		);
		
		var wms_labels=new OpenLayers.Layer.WMS(
			'Location Labels',
			'http://vmap0.tiles.osgeo.org/wms/vmap0',
			{layers:'clabel,ctylabel,statelabel', transparent:true},
			{visibility:false,opacity:.5}
		);
		
		var wms_state_line=new OpenLayers.Layer.WMS(
			'state line layer',
			'http://vmap0.tiles.osgeo.org/wms/vmap0',
			{layers:'stateboundary',transparent:true},
			{displayInLayerSwitcher:false,minScale:13841995.078125}    //   Control   
		);
		
		var wms_water_depth=new OpenLayers.Layer.WMS(
			'water depth',
			'http://vmap0.tiles.osgeo.org/wms/vmap0',
			{layers:'depthcontour',transparent:true},
			{opacity:.8}
		);
		
		var wms_roads=new OpenLayers.Layer.WMS(
			'roads',
			'http://vmap0.tiles.osgeo.org/wms/vmap0',
			{layers:'priroad,secroad,rail',transparent:true},
			{transistionEffect:'resize'}        //     
		);
		map.addLayers([wms_base,wms_labels,wms_state_line,wms_water_depth,wms_roads]);
		
		map.addControl(new OpenLayers.Control.LayerSwitcher({}));
		
		if(map.getCenter()){
			map.zoomToMaxExtent();
		}	
	}
</script>
</body>
</html>

--------
        효과 표시:

좋은 웹페이지 즐겨찾기