Hi,
is there any posibility to select only the Features located inside the Selection-Geometry?The Method featureLayer.selectFeatures(query,FeatureLayer.SELECTION_NEW) as well takes the Features intersecting the shape of the Selection-Geometry
Chris
You're correct. That should have been SPATIAL_REL_CONTAINS
Thank you!
thank you for the response. Your Suggestion works in the wrong direction.
I want to select all PolygonFeatures from FLayer located completly in
a handdrawn Polygon called geo.
SPATIAL_REL_WITHIN gives a result if geo is complete located in one Feature
of FLayer.
function clipFLayer(geo) {
var selectionQuery = new esri.tasks.Query();
selectionQuery.spatialRelationship = esri.tasks.Query.SPATIAL_REL_WITHIN;
selectionQuery.geometry = geo;
FLayer = new esri.layers.FeatureLayer(theService, {outFields: ["*"]});
FLayer.selectFeatures(selectionQuery,esri.layers.FeatureLayer.SELECTION_NEW);
FLayer.on("selection-complete", findRelatedRecords);
}
You can set the spatialRelationship method of the Query task. By default, it's SPATIAL_REL_INTERSECTS, but you can set it to <CODE>SPATIAL_REL_WITHIN.
SPATIAL_REL_INTERSECTS
<CODE>SPATIAL_REL_WITHIN
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.