arcgis4.0畫圈并做空間查詢加入查詢到的點

// 畫圈圈

addCircleGraphic(graphic) {

const target =new this.$esri.Point({type:'point',x: graphic.geometry.x,y: graphic.geometry.y,spatialReference:this.$mapView.spatialReference })

const distanceObj = {

1:0.05,

2:0.1,

3:0.2

? ? }

const distance =distanceObj[graphic.attributes.level]

const circleGeometry =new this.$esri.Circle({

center:target,

radius:distance,

radiusUnit:'kilometers',

spatialReference:this.$mapView.spatialReference

? ? })

const circleGraphic =new this.$esri.Graphic({

geometry:circleGeometry,

symbol: {

type:'simple-fill',

color: [247,193,6,0.3],

outline: {

width:2,

color:'#F7C106'

? ? ? ? ? ? }

}

})

this.layers.forecastCircleDistanceLayer.add(circleGraphic)

this.addRelationGraphic(target,distance)

},

// 空間查詢,并加入點

async addRelationGraphic(target, distance) {

const query =new this.$esri.Query({

geometry: target,

distance,

units:'kilometers',

spatialRelationship:'intersects',

returnGeometry:true,

outFields: ['*']

})

// 相關(guān)的公交站

? ? const queryTask =new this.$esri.QueryTask({

url:`${layerUrl.YTH_PS_BUS_STATION}/0`

? ? })

const p1 =queryTask.execute(query)

// 相關(guān)的學(xué)校

? ? const queryTask2 =new this.$esri.QueryTask({

url:`${layerUrl.YTH_PS_SCHOOL}/0`

? ? })

const p2 =queryTask2.execute(query)

// 政府機(jī)關(guān)

? ? const queryTask3 =new this.$esri.QueryTask({

url:`${layerUrl.YTH_PS_GOVERNMENT}/0`

? ? })

const p3 =queryTask3.execute(query)

// 醫(yī)院

? ? const queryTask4 =new this.$esri.QueryTask({

url:`${layerUrl.YTH_PS_HOSPITAL}/0`

? ? })

const p4 =queryTask4.execute(query)

// 火車站

? ? const queryTask5 =new this.$esri.QueryTask({

url:`${layerUrl.YTH_PS_TRAIN_STATION}/0`

? ? })

const p5 =queryTask5.execute(query)

// 地鐵站

? ? const queryTask6 =new this.$esri.QueryTask({

url:`${layerUrl.YTH_METRO_STATION}/0`

? ? })

const p6 =queryTask6.execute(query)

const typeNameList = ['bus-station','school-relation','government-relation','hospital-relation','train-station-relation','metro-station-relation'];

(await Promise.all([p1,p2,p3,p4,p5,p6])).forEach((results, i) => {

if (results.features.length) {

results.features.forEach(item => {

item.attributes.typeName =typeNameList[i]

item.symbol = {

type:'picture-marker',

url:require('@/assets/images/water-emergency/card-forecast/legend/' +typeNameList[i] +'.png'),

width:30,

height:30

? ? ? ? ? ? ? ? }

})

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

}

})

if (this.circleRelationDataSource.length) {

// 添加數(shù)據(jù)

? ? ? ? this.layers.forecastCircleDistanceLayer.addMany(this.circleRelationDataSource)

}

},

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容