///图斑定位 function TabQuery(instance_id, layer_name) { require(["esri/map", "esri/geometry/Extent", "esri/SpatitalReference", "esri/graphic", "esri/tasks/QueryTask", "esri/tasks/query", 'esri/symbols/SimpleLineSymbol', 'esri/Color'], function(map, Extent, SpatitalReference, Graphic, QueryTask, Query, SimpleLineSymbol, Color) { var url = "../MapServer/0"; //发布的服务url var QueryTask = new QueryTask(url);//查询任务 var query = new Query();//查询条件 query.where = " instance_id=" + instance_id; query.outSpatialReference = map.extent.spatitalReference; query.returnGeometry = true; QueryTask.execute(query, showClickSearchResult);//执行查询返回要进行高亮显示的graphics function showClickSearchResult(result) { map.graphics.clear(); var graphic = result.features[0]; var searchsymbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE.SOLID, new Color([0, 255, 255]), 3)//高亮样式 graphic.setSymbol(searchsymbol); map.graphics.add(graphic);//添加到地图中去图形 var returnGeometry = graphic.geometry; var returnExtent = returnGeometry.getExtent(); returnExtent = returnExtent.expend(2); map.setExtent(returnExtent);//设置到范围 // body... } // body... }) // body... }