我想使用api getFeatures()获取功能,但是它告诉我getFeatures()不是函数,我在哪里需要解决?
componentDidMount(){
window.a = [];
window.layer = new Tile({
source: new TileArcGISRest({
url:'http://localhost:6080/arcgis/rest/services/MyMapService/MapServer',
})
});
for(let i=0;i<83;i++){
for(let j=0;j<87;j++){
for(let k=0;k<5;k++){
for(let l=0;l<5;l++){
window.a.push([98.875+0.025*j+0.005*k,26.7-0.025*i-0.005*l,rain.data.values[i][j]])
//a.push([100.875+0.025*j+0.0025*k,26.7-0.025*i-0.0025*l,rain.data.values[i][j]])
}
}
}
}
var map = new Map({
target: 'map',
layers: [
window.layer
],
view: new View({
center: [100.1811924164254, 25.78602688913871],
projection: 'EPSG:4326', //设定坐标系
})
});
let features = window.layer.getSource().getFeatures();
for (let j = 0; j < features.length; j++){
var polygonGeometry = features[j].getGeometry();
window.b = window.a.filter(item=>polygonGeometry.intersectsCoordinate([item[0],item[1]]))
}
}
我只想判断一个点是否在某个区域内。要使用intersectsCoordinate(),我必须获取特征。