map = new Map("map_box", {
logo: false,
slider: false,//开启放大缩小 true
backgroundColor: backgroundColor,
extent: startExtent
});
slJNLayer = new ArcGISTiledMapServiceLayer(url);
slJNLayer.setVisibility(true);
map.addLayer(slJNLayer);
//地图点击事件监听
map.on('click',mapClick);
//获得点击的地图坐标(点坐标),并创建空间查询参数对象
function mapClick(e)
{
//获得用户点击的地图坐标
var point = e.mapPoint;
//查询方法
var identifyParam = new esri.tasks.IdentifyParameters();
identifyParam.geometry = point;
identifyParam.layerIds = self.mapServicesConfig.quXian.layerIndex[0];
identifyParam.returnGeometry = true;
identifyParam.spatialReference = map.spatialReference;
identifyParam.tolerance = 5;
identifyParam.mapExtent = map.extent;
identifyParam.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE; //.LAYER_OPTION_ALL;
identifyParam.ReturnZ = true;
var queryUrl = self.mapServicesConfig.quXian.url;
var identifyTask = new esri.tasks.IdentifyTask(queryUrl);
identifyTask.execute(identifyParam,showQueryResult);
};
//查询结果featureSet
function showQueryResult(featureSet) {};
ArcGIS API for JS 点击查询属性
于 2020-12-17 16:50:13 首次发布