Chengyi,
Well then you need to do exactly what I mentioned then.
require(["esri/geometry/geometryEngine"], function(geometryEngine) {
view.graphics.forEach(function(gra){
if(geometryEngine.intersects(gra, userDrawnGraphic)){
/* now do something */
}
});
});
To query a graphics layer you have to loop through the layers graphics and perform your operation on each graphic.
You can use GeometryEngine methods like intersects:
https://developers.arcgis.com/javascript/3/jsapi/esri.geometry.geometryengine-amd.html#intersects
Or if the geometry you want to check is a point geometry, to check if it is inside a polygon then you can use Polygon.contains
https://developers.arcgis.com/javascript/3/jsapi/polygon-amd.html#contains
Thank you very much !
Let me explain. Many ploygon are drawn on the graphic when the map is initialized,then I want to draw a new ploygon to search the old ploygon with 4.5 arcgis api for javascript . How to do?
Chengyi,
Well then you need to do exactly what I mentioned then.
require(["esri/geometry/geometryEngine"], function(geometryEngine) {
view.graphics.forEach(function(gra){
if(geometryEngine.intersects(gra, userDrawnGraphic)){
/* now do something */
}
});
});
Scheitlin
year,this is I needed. thankyou verymuch.