1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
| <!DOCTYPE html> <html> <head> <title>影像分析</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <link rel="stylesheet" href="https://js.arcgis.com/3.28/esri/css/esri.css" /> <script src="https://js.arcgis.com/3.28/"></script> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <style> .MapClass{ width:100%; height:700px; border:1px solid #000; } </style> <script> require(["esri/map","esri/layers/ArcGISImageServiceLayer","dojo/on", "dojo/dom","esri/toolbars/draw", "esri/tasks/ImageServiceIdentifyTask","esri/tasks/ImageServiceIdentifyParameters", "esri/symbols/SimpleLineSymbol","esri/graphic","esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleFillSymbol", "esri/layers/MosaicRule", "dojo/domReady!"],function(Map,ArcGISImageServiceLayer,on,dom,Draw,ImageServiceIdentifyTask, ImageServiceIdentifyParameters,SimpleLineSymbol, Graphic,SimpleMarkerSymbol,SimpleFillSymbol,MosaicRule){ var map=new Map("mapDiv")
var layer=new ArcGISImageServiceLayer("http://localhost:6080/arcgis/rest/services/demo/ImageService_qingdao/ImageServer") map.addLayer(layer); var toolbar =new Draw(map); var task=new ImageServiceIdentifyTask("http://localhost:6080/arcgis/rest/services/demo/ImageService_qingdao/ImageServer"); var params=new ImageServiceIdentifyParameters(); var lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_DASH, new dojo.Color([255, 0, 0]), 3); var marker= new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE,10, lineSymbol, new dojo.Color([255, 0, 0])); var fill= new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, lineSymbol, new dojo.Color([255, 0, 0])); on(dom.byId("drawp"),"click",function(){ toolbar.activate(Draw.POINT, { showTooltips:true }) }) on(toolbar,"draw-complete", function (result) { map.graphics.clear(); var geometry=result.geometry; params.geometry =geometry; graphic= new Graphic(geometry, marker); map.graphics.add(graphic); toolbar.deactivate(); }) on(dom.byId("btn"),"click",function(){ var mosaicRule=new MosaicRule(); mosaicRule.ascending=false; mosaicRule.method=MosaicRule.METHOD_CENTER params.mosaicRule=mosaicRule params.pixelSizeX=layer.pixelSizeX; params.pixelSizeY=layer.pixelSizeY; task.execute(params,function(result){ alert(result.value) }) }) }); </script> </head> <body> <div id="mapDiv" class="MapClass"></div> <button id="drawp">绘制点</button> <button id="btn">查询</button> </body> </html>
|