Hi I'm working with Javascript Maps SDK version 4.31. I'm running a query on a featurelayer returning the geometry but I'm not able to access latitude, longitude, x or y properties. Here's my code:
let query = featureLayer.createQuery();
query.returnGeometry = true;
query.where = "1=1";
query.outFields = ["OBJECTID", "Permittee"];
query.orderByFields = ["Permittee"];
featureLayer.queryFeatures(query)
.then(function(response){
for (let i=0; i < response.features.length; i++){
let data: DischListData = new DischListData();
data.Permittee = response.features[i].attributes.Permittee;
data.ObjectID = response.features[i].attributes.OBJECTID;
//TRYING TWO WAYS TO GET THE DATA
//1) THESE THROW PROPERTY DOES NOT EXIST ERROR data.Lat= response.features[i].geometry.latitude;
data.Long= response.features[i].geometry.longitude;
//2) THESE ARE NULL
data.Lat= response.features[i].geometry.extent.center.longitude;
data.Long= response.features[i].geometry.extent.center.longitude;
a.listData.push(data);
}
console.log(a.listData);
});
I can see the latitude and longitude property values in my debug console (see attached screen shot) but cant access them in my code. I've also tried to access the graphic property from my returned features, but not having any luck there either. Does anyone know how I can get lat, long, x, and y? Ultimately I want to zoom to a point when a user selects the name of a Permittee from a dropdown.
Thanks
Pete