Hi all,
I am trying to use the buffer extent into my query but I am not successful. Any idea why I get the following error?
Thanks,
Alex
arrayUtil.forEach(bufferedGeometries, function (geometry) {
var graphic = new Graphic(geometry, symbol);
map.setExtent(graphicsUtils.graphicsExtent(graphic), true);
map.graphics.add(graphic);
var queryTask = new QueryTask("http://itas46:6080/arcgis/rest/services/Alex_test/TreeMortalityLayers/MapServer/9");
var query = new Query();
query.returnGeometry = true;
query.geometry = geometry;
query.outFields = ["OWNER_NAME", "OWNER_ADDR", "OWNER_CITY"];
query.outSpatialReference = map.spatialReference;
queryTask.execute(query, addToMap);
});
}
function addToMap(results) {
var symbol8 = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
new Color([255, 0, 0]), 3), new Color([18, 29, 224, 0.35]));
var featureArray = results.features;
if (featureArray && featureArray.length > 0) {
// do stuff with the features
arrayUtils.forEach(featureArray, function (feat) {
feat.setSymbol(symbol8);
map.graphics.add(feat);
});
} else {
alert("No features found")
}
Alex,
Can you expand the first error and screenshot again?
It now works but I still get an error. Not too sure why.
Code:
arrayUtil.forEach(bufferedGeometries, function (geometry) {
var graphic = new Graphic(geometry, symbol);
map.graphics.add(graphic);
var queryTask = new QueryTask("http://itas46:6080/arcgis/rest/services/Alex_test/TreeMortalityLayers/MapServer/9");
var query = new Query();
query.returnGeometry = true;
query.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;
query.geometry = graphic.geometry;
query.outFields = ["OWNER_NAME", "OWNER_ADDR", "OWNER_CITY"];
query.outSpatialReference = map.spatialReference;
queryTask.execute(query, queryCallback);
});
}
function queryCallback(featureSet) {
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])
);
var features = featureSet.features;
dojo.forEach(features, function (feature) {
feature.setSymbol(symbol);
map.graphics.add(feature);
});
}
Alex,
What is line 384 - 386 in your index.html?
That is this:
arrayUtil.forEach(bufferedGeometries, function (geometry) {
var graphic = new Graphic(geometry, symbol);
map.graphics.add(graphic);
However, I just get that error now: