argcis4.0 对自定义FeatureLayer做空间查询

async creatMetroLayer() {

const {content } =await getMetroList({

pageNum:1,

pageSize:999999

    })

// 构建 graphics

    const graphics =content.list.map(item => {

return {

geometry: {

type:'point',

x: item.coox,

y: item.cooy,

spatialReference:this.$mapView.spatialReference

            },

attributes: item,

symbol: {

type:'picture-marker',

url:require('@/assets/images/water-emergency/img/layer-control/layer-img/metroLayer.png'),

width:18,

height:18

            }

}

})

this.layers.metroLayer =new this.$esri.FeatureLayer({

id:'forecastmetroLayer',

title:'',

visible:false,

source:graphics,

objectIdField:'id',

outFields: ['*'],

fields: [{

name:'objectid',

alias:'',

type:'oid'

        }, {

name:'coox',

alias:'',

type:'string'

        }, {

name:'cooy',

alias:'',

type:'string'

        }],

geometryType:'point',

spatialReference:this.$mapView.spatialReference

    })

await this.$mapView.map.add(this.layers.metroLayer)

},


const queryTask6 =this.layers.metroLayer.createQuery()

queryTask6.geometry = circleGeometry

queryTask6.returnGeometry =true

queryTask6.outFields = ['*']

await this.layers.metroLayer.queryFeatures(queryTask6).then(results => {

if (results.features.length) {

results.features.forEach(item => {

item.attributes.typeName ='metro-station-relation'

            item.symbol = {

type:'picture-marker',

url:require('@/assets/images/water-emergency/img/layer-control/layer-img/metroLayer.png'),

width:30,

height:30

            }

})

this.circleRelationDataSource.push(...results.features)

}

})

你可能感兴趣的:(argcis4.0 对自定义FeatureLayer做空间查询)