3.*的时候用的是ArcGISDynamicMapServiceLayer
4.*的时候可以用MapImageLayer加载动态地图
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OGC的WMS调用</title>
<link
rel="stylesheet"
href="https://js.arcgis.com/4.15/esri/themes/light/main.css"
/>
<script src="https://js.arcgis.com/4.15/"></script>
<style>
html,
body,
#myView{
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/MapImageLayer"
],function(
Map,
MapView,
MapImageLayer
){
var myDynamicLayer=new MapImageLayer({
url: "http://localhost:6080/arcgis/rest/services/OGCtest/MeiXiCunWMS/MapServer",
})
var map=new Map({
basemap: {
baseLayers: [myDynamicLayer]
}
})
var view=new MapView({
container: "myView",
map: map,
})
})
</script>
</head>
<body>
<div id="myView"></div>
</body>
</html>