浏览器访问图层可看到的信息
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test Map</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.37/esri/css/esri.css">
<script src="https://js.arcgis.com/3.37/"></script>
<style>
html,
body,
#map {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
#addbtn {
position: absolute;
z-index: 999;
top: 20px;
left: 100px;
}
</style>
<script>
require([
'esri/map', 'esri/layers/WMSLayer', 'esri/geometry/Extent'],
function (Map,WMSLayer,Extent) {
var map = new Map("map", {
// 底图格式
basemap: "",
// 视觉中心点
center: [118.779, 32.044],
// 缩放等级
zoom: 13,
});
var resourceInfo = {
extent: new Extent(35589494.39077643, 3216093.203666591, 35643975.400229566, 3333335.1139954245, { wkid: 4523 }),
layerInfos: [],
version: '1.1.1'
};
chunUrl = '你的wms服务'
var geoWmsLayer = new WMSLayer(chunUrl, {
resourceInfo: resourceInfo,
opacity: 0.5
});
geoWmsLayer.setImageFormat("png");
geoWmsLayer.setVisibleLayers(["bishan-water:bishanVillage2018"]); // 图层名
map.addLayer(geoWmsLayer);
});
</script>
</head>
<body>
<div id="map">
</div>
</body>
</html>