Select to view content in your preferred language

Saving a graphics layer

3044
2
04-05-2010 04:58 AM
SpencerWilliams
New Contributor
I am in the process of building (3000 lines of code so far :)) a silverlight application using the ArcGIS Silverlight API.  A known requirement for this application will be the ability to add notes.  With the release of v2.0 of the API this will be possible!  I can't wait for it to be released to production.  I have added the ability to save layers to the app.  Fortunately, this doesn't require anything but saving a SQL string and/or a list of Unique_ID's (each graphic has one). 

I got a little feature-happy and added the ability to add text to the map via TextSymbols.  This, combined with being able to draw polygons and points on the map have made it very valuable.  So now I have a problem.  I am trying to save the users' "session". 

The session would be anything the user is doing on the screen at the time.  As soon as users begin testing this application, there will be a request like, "now i want to take what's on my screen, and show that to someone later - can't I just save it in the system?"

I can save the other graphics layers by writing the sql querystring that was used to build them to a DB and retrieving it for later use.  I can save graphic "selections" by saving an array of unique_id's.  I am looking for the best way to save a graphics layer that can have virtually anything on it.  Text with points, polylines, polygons, freehand lines, etc.  I know it sounds like this should be incorporated with the feature service...as far as I know, the feature service doesn't have a place for "annotations" - this is what I am using the TextSymbol for. 

I have seen this post http://forums.esri.com/Thread.asp?c=158&f=2455&t=297091&mc=2 , but I am thinking that there must be a better way.  Is there any way to export the JSON of a graphics layer in code to SDE?  I am worried that if I store points/lines/textpoints, etc in my own way (probably JSON stored in SQL), that there will be a problem retrieving it in a newer version of the API down the road.  If something like writing an entire graphics layer to a row of a table in SDE is possible - please let me know as that would be much better than what I am thinking.

I also read this post http://blogs.esri.com/Dev/blogs/silverlightwpf/archive/2010/03/11/Sending-geometry-between-Silverlig... , however, there's no instruction on how to save that data to SDE (of course I can save the JSON to SQL, but that won't give me any geoprocessing capabilities in the future with that data).  What I really need is the graphics layer in full - symbols, attributes, graphics, etc.  I am thinking the only way to do this is to save geometry (because it is serializable) via the blog post example, create my own classes to capture the symbols and attributes - then capture those as well via WCF.  What say you - ESRI gurus?


Thanks for your help,

Spencer Williams
0 Kudos
2 Replies
dotMorten_esri
Esri Notable Contributor
The simplest solution is by far using the built-in editing service in ArcGIS Server v10. The text in your symbol is simply just an attribute you bind into the symbol template. The Feature Service also allows you to define the symbology at the server and push it to the client.
I don't see why a feature layer can't be used for "annotations". Just create a new layer, call it annotations, and it's suddenly an annotation feature layer. Or create 3 if you need both point, polyline and polygon.

The blogpost doesn't cover SDE storage. The point of the post was to show how to get geometry to the server side. What you want to do with it from there is all up to you. If the blogpost had to cover all the possible storage scenarios, it wouldn't have been a blogpost but a whole book 🙂
0 Kudos
SpencerWilliams
New Contributor
Thanks Morten.  I will play with the binding and attribute to a textsymbol when 2.0 gets released in public beta.
0 Kudos