Setting map extent from a point FeatureSet
I'm trying to set the map extent based on a Combo Box selection > Query Task. The result is a Featureset of type point. I then run a GetGeometries on the FeatureSet to create a Collection of type Ienum<Esri.ArcGIS.Client.Geometry.Geometry> - just wondering what the next step is to SetMapExtent. I could enumerate through the FeatureSet to get x/y max/min and create an envelope but it just seems there must be an easier way and I'm missing the obvious. Any thoughts?
James
-
Use the Get Feature Set Extent tool to get the Feature Set envelope.
If your Feature Set contains one point, you should create an extent envelope (a single point has no extent).
0 -
Perfect - thanks Nico. The tool was sitting there the whole time while I was trying to re-invent the wheel - much appreciated!
0 -
I know this is an old post but can anyone elaborate more on the steps to creating a zoomable extent from a Feature Set consisting of only one point? I'm not quite sure how to develop the extent envelope and set its X and Y values. Wouldn't it be easier to somehow buffer the point in the Feature Set instead? Any help would be appreciated. 0 -
Erick,
I can't remember where I got this, I am sure it was from the code gallery as I was looking through some example workflows. But basically you check to see if the the featureset contains more than 1 element. If it doesn't, then you'll add or subtract a specified offset distance from the x and y value to create a box around the single point.
Here is a screen shot, I'll be more than happy to post my code if you need more assistance:_img_ alt="User-added image" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=90760000000XbJR&feoid=Body&refid=0EM60000000XtWI" _/_img_
resultEnvelope is of type Geometry.Envelope
Then just use the 'set map extent' workflow activity to resultEnvelope.Extent0 -
You could always buffer a point and set your extent to the buffer. 0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
5 Kommentare