When you first define the feature layer, add the property:mode: FeatureLayer.MODE_SELECTIONThen when querying by geometry, don't use featureLayer.queryFeatures(query, function(){use this insteadfeatureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(){Only selected features will be displayed on the map.
featureLayer.queryFeatures(query, function(){
featureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(){
Doing somethign like (below):selectionToolbar = new esri.toolbars.Draw(map);dojo.connect(selectionToolbar, "onDrawEnd", function (geometry) { selectionToolbar.deactivate(); var query = new gQuery(); query.outFields = outfieldsList; if (whereClause) query.where = whereClause; query.geometry = geometry; query.returnGeometry = true; query.spatialRelationship = Query.SPATIAL_REL_INTERSECTS; query.outSpatialReference = featureLayer.spatialReference; featureLayer.queryFeatures(query, function (featureSet) { });});It's filtering by the geometry as I can see by inspecting featureSet.features list but the features being show on the map is not corresponding to the features that are being returned by the query.If I put in featureLayer.clear() before calling the query, all features are removed from the map.The funny thing is when I query with a where clause but without the user of geometry filter, then what is returned from teh query is reflected on the map. Why might filtering by where clause and by geomotry be different in terms of not what the result of the query would be but in terms of what is shown on the map?
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.