Zoom to First Feature in Selected Set
Essentials 4.3 HTML5 2.4
I'm having trouble stringing together a set of activities that gets me zoomed to the first feature in a set of SelectFeatures.
I've executed a Query Task and have a FeatureSet. I want to zoom the map to the first feature in the results list rather than zoom out to the extent of the FeatureSet.
My mind is going numb.
Help.
-
Get the first geometry with an Assign featuresetvariable.Features.First.Geometry (it could be necessary to import the System.Linq namespace).
Get the Extent with a second assign (geometryvariable.Extent)
Use the Set Map Extent activity to set the extent.
It's good to expand the zoom extent a little bit around the feature, use extentvariable.Expand(1.25).
If your geometries are points, the method described above will not work. In this case you could use the Get Centroid activity to get the coordinates of the point geometry and create a new envelope based on the coordinates (http://help.arcgis.com/en/webapi/silverlight/2.0/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Geometry.Envelope~_ctor(Double,Double,Double,Double).html)
0 -
Thanks, Nico.
I was missing the assign geometry to a variable step!
Sometimes my brain just hurts . . .
0
Please sign in to leave a comment.
Comments
2 comments