function AddWMSLayer(LayerName) {
var _WMSUrl =“http://10.0.4.141:6080/arcgis/services/poss1/MapServer/WmsServer”;
var layerGroup = sg.ProjectTree.FindItem(“Layers”);
if (layerGroup == “”){
layerGroup = sg.ProjectTree.CreateGroup(“Layers”, “”);
}
if (LayerName != null && LayerName != "") {
var itemidlayer = sg.ProjectTree.FindItem("Layers\\" + LayerName);
if (itemidlayer != ""){
sg.ProjectTree.DeleteItem(itemidlayer);
}
var wmsStr =
"[INFO]\n" +
"Meters=1.2m\n" +
"MPP=0.000027578125" + "\n"
+"Url=" + _WMSUrl + "?request=GetMap&Version=1.3.0&service=WMS&crs=CRS:84&bbox=113.54910763279433,24.5858358542103,113.57569495732433,24.628050567114293&height=256&width=256&layers=0&styles=&format=image/png\n"
+ "xul=113.54910763279433" + "\n" +
"ylr=24.5858358542103" + "\n" +
"xlr=113.57569495732433" + "\n" +
"yul=24.628050567114293" + "\n";
var imagelayer = sg.Creator.CreateImageryLayer("wms",113.54910763279433, 24.5858358542103,113.57569495732433,24.628050567114293, "<EXT><ExtInfo><![CDATA[" + wmsStr + "]]></ExtInfo><ExtType>wms</ExtType></EXT>", "gisplg.rct", layerGroup, LayerName);
imagelayer.CoordinateSystem = sg.Terrain.CoordinateSystem;
}
}
修改一下
————————————————
版权声明:本文为CSDN博主「li_ming_yue」的原创文章,遵循CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/li_ming_yue/article/details/88990584
原文地址:https://www.cnblogs.com/li-mingyue/p/skyline_js.html