Hi all,
I am not too sure why but one of my queries (against an AGOL layer) is returning no geometry when it should:
$( "#tags" ).autocomplete({
source: ProjectNames,
select: function( event, ui ) {
var value = ui.item.value;
console.log(value);
var queryTaskProjects = new QueryTask("http://services.arcgis.com/UHg8l1wC48WQyDSO/arcgis/rest/services/Projects/FeatureServer/0");
//build query filter
var queryProjects = new Query();
queryProjects.returnGeometry = true;
queryProjects.outFields = ["Name", "ACRES"];
queryProjects.where = "Name = " + "'" + value + "'";
queryTaskProjects.execute(queryProjects, addToMap4);
}
});
function addToMap4(featureSet) {
var resultFeatures = featureSet.features;
var AOI = featureSet.geometry;
console.log(resultFeatures);
console.log(AOI);
var symbol = new SimpleFillSymbol(
SimpleFillSymbol.STYLE_SOLID,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([255, 0, 0, 0.65]), 2
),
new Color([255, 0, 0, 0.35])
);
arrayUtil.forEach(resultFeatures, function (feature) {
console.log(geometry);
var AOI = feature.geometry;
projectareaexisting = new Graphic(AOI, symbol);
map.graphics.add(projectareaexisting);
});
}
Solved! Go to Solution.
The error is in the line
console.log(geometry);
here the variable geometry is not defined before using it.
Alex,
Have you run the check geometry toolbox against the featureclass that the map service is using in ArcMap?
I just tried. No errors were found. I also have filtering the layer in AGOL.
Alex,
Is there any difference if you remove the filtering?
The error is in the line
console.log(geometry);
here the variable geometry is not defined before using it.