Select to view content in your preferred language

I can't go to the selected layer. Can you help me with my little mistake? (reading 'geometry')

28
0
3 hours ago
emreaktas1
New Contributor III

Hello esri community,
I can't go to the selected layer. Can you help me with my little mistake?

I want to select all with a control button.
I want to show the selected data on the map. but it gives a small error;
(typeError: Cannot read properties of undefined (reading 'geometry'))

 

// js code

 

// Hepsini Seç toplulastırma
let inputOll
    inputOll = document.getElementById("hepsinisec4");

inputOll.addEventListener("click", itemOll)
  function itemOll(e){

inputOll.classList.add("itemsOll")

if(inputOll.checked == true){

let checkOll
checkOll = document.querySelectorAll(".item4")

checkOll.forEach(checkall => {
checkall.classList.add("checked")
})

let checkedd = document.querySelectorAll(".checked"),
btnText = document.querySelector(".btn-text22");

if(checkedd && checkedd.length > 0){
btnText.innerText = `Seçilen ${checkedd.length} `;


}else{
btnText.innerText = "Seçilen yok";        
}


view.whenLayerView(layerParsel).then(function(layerView) {
layerView.highlightOptions = {
color: "#FF00FF", //bright fuchsia
haloOpacity: 0.8,
fillOpacity: 0.3
};

let tbl1;
let tablotr

// tbl1 = tablebodytr2.children[4].children[1].children
tbl1 = document.querySelectorAll(".item")
tbl1.forEach(function(tablebodytr2){
 tablotr= tablebodytr2.children[4].children[1].children

})


console.log(tbl1,"tbl1")
let query = layerParsel.createQuery();

query.where = `ada_parsel_new  = '${tablotr}'`;    
layerParsel.queryFeatures(query).then(function(result){
// highlight?.remove();
highlight = layerView.highlight(result.features);
const feature = result.features[0];

view
.goTo(
{
  target: feature.geometry,
  //tilt: 70,
  zoom: 15
},
// {
//   duration: 2000,
//   easing: "in-out-expo"
// }
 )
// .then(() => {
//   view.openPopup({
//     features: [feature],
//     location: feature.geometry.centroid
//   });
// })


});
})

}

else{
highlight.remove();
let removechecked
removechecked = document.querySelectorAll(".checked"),
removechecked.forEach(function(removecheckedd){
removecheckedd.classList.remove("checked")
})

}

}


// Hepsini seç toplulastırma Son
0 Kudos
0 Replies