- I am quering a FC for a specific field value
- Returning the Feature and displaying it in a Graphic.
- This works fine.
- I am then attempting to do the same by calling another function to
- Use the Geometry of the Graphic to select all the COunty Features that Intersect it...
- THis part if failing and I cant see why.
Both FC are Web Mercator Aux Sphere
The Map is defined as follows ---- I think this defaults to Web Mercator Web Aux?
var mapright = new Map({
basemap: "dark-gray",
layers: [resultsLayer3, resultsLayer2, countyLayerWebMercator]
});
var viewright = new MapView({
container: "viewDivright",
map: mapright,
center: [-77.05, 37.53308],
zoom: 7
});
PART ONE query, get geometry create Graphic
function queryMultipartPolyongUniqueID3(feature) {
var str = feature;
var query = "";
query = MultiPartPolygonsLayer.createQuery();
query.where = "ADDRESSgeo = '" + str + "'";
return MultiPartPolygonsLayer.queryFeatures(query);
}
function displayResultsUniqueID(results) {
resultsLayer2.removeAll();
var features2 = results.features.map(function (graphic) {
graphic.symbol = {
type: "simple-fill",
style: "solid",
color: [240, 248, 255, 0.9],
size: "10px",
outline: {
color: [240, 248, 255, 0.9],
width: 1
}
};
return graphic;
});
var numCounties2 = features2.length;
resultsLayer2.addMany(features2);
queryCountiesthatIntersect().then(displayResults2);
}
THEN Call the second function at the end ----
// CALL THE SECOND FUNCTION
queryCountiesthatIntersect().then(displayResults2);
1. If I comment out the call to this 2nd function that code runs without error.
2. If I run it with the call to the second function I get the below error.
ERROR
dojo.js:218 [esri.core.Accessor] Accessor#set Invalid property value, value needs to be one of 'esri.geometry.Extent', 'esri.geometry.Multipoint', 'esri.geometry.Point', 'esri.geometry.Polyline', 'esri.geometry.Polygon', or a plain object that can autocast (having .type = 'extent', 'multipoint', 'point', 'polyline', 'polygon')
QUESTIONS:
Am I getting this error because I am trying to use a Graphic Layer from the First Function Above?????
Can I use graphic Layer? If so do I need to define it differently?
Do I need to use a Feature Layer?
function queryCountiesthatIntersect() {
var query = countyLayerWebMercator.createQuery();
query.geometry = resultsLayer2;
query.spatialRelationship = "intersects";
return countyLayerWebMercator.queryFeatures(query);
}
function displayResults2(results) {
resultsLayer3.removeAll();
var features3 = results.features.map(function (graphic) {
graphic.symbol = {
type: "simple-fill",
style: "solid",
color: [240, 248, 255, 0.9],
size: "10px",
outline: {
color: [191, 42, 18, 0.9],
width: 1
}
};
return graphic;
});
var numCounties = features3.length;
resultsLayer3.addMany(features3);
}