How do I convert ExternalObject event args data captured by EditorPreUpdateFeatureEvent back to graphic/geometry in workflow
Hi All - I'm trying to develop a workflow that fires off additional processing after a user finishes editing a feature using standard Editing tools incorportated into the HTML5Viewer (v2.5.1 & GE 4.4.2). After spending quite a bit of time digging through GE documentation and forums, it looks like my options are limited for having a workflow interact with the Editing tools, short of customizing the HTML5 viewer (something I prefer to avoid) by adding a custom event/listener to invoke the editor to edit the feature's geometry.
So, I discovered that I can write a workflow that runs on viewer startup that listens for the "EditorPreUpdateFeatureEvent" using the ListenForExternalEvent activity, then use a CollectExternalEventArgs activity that waits for the event and plops the data into an ExternalObject type variable when the user saves the edits made to a feature. I confirmed the event fires when the user hits the Save button on the edit form using an Alert activity and outputting the EventArgs data via the eventArgs.Json property. The data contains the geometry of the feature edited (no attribute data... unfortunately).
What I am trying to accomplish is to use the collected event args data to query a feature service using the geometry of the edited feature (since I do not have any attribute data). My question is, how do I convert the collected EventArgs data back to a geometry object type that I can use with the QueryTask activity? Or, is there another way to go about this (without customizing the HTML5 viewer)?
Below is a eventArgs.Json output of the data collected from the external event:
{"0":{"geometry":{"type":"polygon","rings":[[[-13634496.056128735,6238241.751916992],[-13632929.09704331,6236082.405899485],[-13636731.839220403,6236082.405974027],[-13636602.851683619,6237981.388370739],[-13634496.056128735,6238241.751916992]]],"_ring":0,"spatialReference":{"wkid":102100,"latestWkid":3857}},"symbol":{"color":{"r":0,"g":0,"b":0,"a":0},"outline":{"color":{"r":230,"g":0,"b":169,"a":1},"width":4,"type":"simplelinesymbol","style":"solid","_inherited":{"p":2}},"type":"simplefillsymbol","style":"solid","_inherited":{"p":2}},"attributes":null,"infoTemplate":null}}
I've gone down various bunny trails... the last path involved casting the Json data to a Dictionary, which gave resulting in a dictionary with a single key of "0"... which I then took the data in key "0", cast it to an object then into a dictionary which resulted in a few keys allowing me to get the Spatial Reference and shape type (polygon). I then did another series of casts and ForEach activities to loop through the geometry data rings and points. So, in short, I can access the raw data, but then I got stuck trying to convert this all into a geometry object I can pass into the ArcGIS Server QueryTask activity. I'm beginning to think this last path is doing things the hard way. Any thoughts / tips / tricks are much appreciated !
- Brian
0
-
myPolygon = {"geometry":{"type":"polygon","rings":[[[-13634496.056128735,6238241.751916992],[-13632929.09704331,6236082.405899485],[-13636731.839220403,6236082.405974027],[-13636602.851683619,6237981.388370739],[-13634496.056128735,6238241.751916992]]],"_ring":0,"spatialReference":{"wkid":102100,"latestWkid":3857}},"symbol":{"color":{"r":0,"g":0,"b":0,"a":0},"outline":{"color":{"r":230,"g":0,"b":169,"a":1},"width":4,"type":"simplelinesymbol","style":"solid","_inherited":{"p":2}},"type":"simplefillsymbol","style":"solid","_inherited":{"p":2}},"attributes":null,"infoTemplate":null} myGraphic = new Graphic(myPolygon)This doesn't work? Not trying code but just push the JSON back in. Unfortunately, Esri left out the FeatureSet.FromJSON from the Javascript API. Not that something like that would be useful or anything.0 -
But if you want to mess around with JSON, I really recommend importing the Newtonsoft.JSON library. 0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
2 kommentarer