Map Extent to New Feature
Hi,
This seems like it should be easy. I need to capture the current extent of the map and add that polygon to a feature class. I start with GetMapExtent, but don't know how to convert the resulting envelope to a feature.geometry so I can use the AddFeatures to a feature layer.
Any help would be apprecieted (I'm keeping my fingers crossed for a simple answer..).
Brad
-
Cast the extent envelope to a geometry object
Create a new graphic object
Assign the geometry to the .Geometry property of the graphic
Create a new collection
Add the graphic to it
Use the collection in the Add Features activity
0 -
Thanks Nico,
It's the Cast activity i was missing. I have added it in, but i'm still getting errors at the AddFeatures stage, and I think it's still to do with the geometry not being applied (I can setup the workflow for the user to select the geometry and it works fine). I have a NewGeom variable (ESRI.ArcGIS.Client.Geometry.Geometry) and NewEnv (ESRI.ArcGIS.Client.Geometry.Envelope). How exactly do I use Cast to transfer the capture extent?
Thanks again.
0 -
When you place a Cast activity on the canvas, you have to enter a data type. Select here ESRI.ArcGIS.Client.Geometry.Geometry
A way to show the contents of your graphic is placing the following expression in an alert of prompt:
New FeatureSet(New List(Of Graphic) From {myGraphicVariable}).ToJson().With some reformatting of the JSON you can use this in the Add Features operation on the ArcGIS Server REST endpoint
http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r30000010m000000
Warning: use of an alert/prompt (client) activity can introduce an error on the Add Features activity, this is related to serialization issues.
0 -
ps. I'm using Geocortex version 4.1.5 with a Silverlight 2.2 viewer.
0 -
Which error do you get on the Add Features?
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
5 Kommentare