1.GraphicsLayer :
const graphic =this.layers.HospitalLayer.graphics.items.find(item => {
return item.attributes.projectid === row.projectId
})
2.图层服务
const queryTask =new this.$esri.QueryTask({
url:`${layerUrl.YTH_SBSS_CUN_GRID}/0`
})
const query =new this.$esri.Query({
returnGeometry:true,
outFields: ['*'],
where:`CUNCODE = '${val.attributes.cuncode}'`
})
queryTask.execute(query).then(res => {
if (res.features.length ===0) {
return
}
console.log(res.features)
const coor = res.features[0].geometry.extent.center
if (res.features.length) {
const point =new this.$esri.Point({
type:'point',
x:coor.x,
y:coor.y,
spatialReference:this.$mapView.spatialReference
})
this.clickEventHandle(point)
}
})
3.FeatureLayer
const query =layer.createQuery()
query.where =`swid = '${row.id}'`
const results =await layer.queryFeatures(query)