I have a Feature Layer where I have successfully got the features using the "setDefinitionExpression()", but now I want to be able to Zoom to the extent of the features from this definition expression. Any ideas on how I could do this?
Thanks
You can use esri/graphicsUtils graphicsExtent method to get the extent of the selected graphics. Here's a code snippet that shows this:
var layer = new FeatureLayer("http://services5.arcgis.com/cuQhNeNcUrgLmYGD/arcgis/rest/services/JT/FeatureServer/0",{ infoTemplate:template, outFields:["*"] }); map.addLayer(layer); on.once(layer, "update-end", function(){ var extent = graphicsUtils.graphicsExtent(layer.graphics); map.setExtent(extent); }); layer.setDefinitionExpression("Tour_Name='NSYNC_in_Concert'")
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.