arcgis js api加载wms服务,官方的参考样例:
WMSLayer | Sample Code | ArcGIS Maps SDK for JavaScript 4.30 | Esri Developer
按照官方样例加载比较奇怪,我们平常习惯用url或者json的方式加载,稍微改一下就行,如下:
javascript
const layer = new WMSLayer({
url: "http://127.0.0.1:8080/geoserver/ne/wms?SERVICE=WMS&REQUEST=GetCapabilities&version=1.3.0",
sublayers: [
{
name: "ne:countries",
title: "Countries",
}
],
});
viewer.map.add(layer);
效果如图: