arcgis for js 添加图片到地图
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" /> 6 <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/> 7 <title></title> 8 <link rel="stylesheet" href="http://js.arcgis.com/3.6/js/esri/css/esri.css"> 9 <style> 10 html, body, #map { height: 100%; width: 100%; margin: 0; padding: 0; } 11 </style> 12 <script src="http://js.arcgis.com/3.17/"></script> 13 <script> 14 var map, mil; 15 16 require([ 17 "esri/map", "esri/geometry/Extent", 18 "esri/layers/MapImage", "esri/layers/MapImageLayer" 19 ], function( 20 Map, Extent, 21 MapImage, MapImageLayer 22 ) { 23 24 map = new Map("map", { 25 basemap: "topo", 26 center: [-79.17, 33.76], 27 zoom: 9 28 }); 29 30 // create and add the layer 31 mil = new MapImageLayer({ "id": "usgs_screen_overlay" }); 32 map.addLayer(mil); 33 34 // create and add the image 35 var extent = new Extent({ "xmin": -8864908, "ymin": 3885443, "xmax": -8762763, "ymax": 3976997, "spatialReference": { "wkid": 102100 }}); 36 var mi = new MapImage({ 37 "extent": extent, 38 "href": "http://i.weather.com.cn/i/product/share/pic/l/PWCP_TWC_STFC_SFER_ER24_TWC_L88_P9_20160911140002400.JPG" 39 }); 40 mil.addImage(mi); 41 42 }); 43 </script> 44 </head> 45 46 <body> 47 <div id="map"></div> 48 </body> 49 </html>