Select to view content in your preferred language

How to show map services in TOC, instead of layers

936
5
03-31-2011 08:16 PM
RhysDonoghue
Deactivated User
I am new to Flex and was looking at the "Dynamic Map Layers on/off" demo here: http://help.arcgis.com/en/webapi/flex/samples/index.html - I want to do exactly the same but instead of one map service showing all of the layers in the TOC (i.e. the one selected from the dropdown menu), I want to show all of my map services in the TOC.  Each of my map services may only have one layer in it (if it is cached).  The reason I want to do it this way is because the service I have is cached.  If it is not cached, the layers draw too slow.  If it is cached, I cannot select which layers to turn on and off.  To my way of thinking if each layer is a map service, I can have them cached and can turn them on and off as I please.  Hope this makes sense.  Anyone got a sample I can look at?
Tags (2)
0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus
Rhys,

   I am not sure that I am understanding your post or you are not understanding how a Cached Map Service works. A Cached Map Service takes all the layers in the map and creates tiles (small images of the map with all the layer) for the map at defined scales. So a cached map can not turn off a particular layer of that map service because the cached image would have been created will all the layers visible. Does that make sense or am I missing you real question.
0 Kudos
RhysDonoghue
Deactivated User
Hi Robert, my post is not so clear and I don't fully understand how cached map services work.  Let me try again.  I currently have four layers in one (non-cached) map service.  They are all showing up in the TOC just like the example and I can turn individual layers on or off like the example.  However they are rendering too slow so I need to cache the service.  This won't work for me because I want to be able to turn individual layers on and off (which as you say I can't do in a cached service).  My understanding is the way to handle this is to put the four different layers into four different cached map services (i.e. each map service has one of the four layers) so rather than turning the layer off, I can turn the service off (which looks to the user like they are just turning the layer off).  So instead of having one map service with four layers shown in the TOC, I want four cached map services showing in the TOC that can be turned on or off with a checkbox.  Hope that makes sense.  Is this the right way to do this or am I on the wrong track?  Can a cached service be turned on and off with a check box, or will it always be on?  My goal is to have my application working exactly like the example but I need the layers to draw faster.  I just had a quick look at the example again.  The example is not cached but is fast enough for my purposes.  However, my application is far slower.  The polygon layer I have can take a minute or more to draw.  My other layers are also taking a long time to draw.  Can I speed this up without caching the service?  I'm using a File Geodatabase for the slow polygon layer and an sde database for the other layers which are also slow but not as bad (and not as big).  The small project I am doing is just for a demo for a client.  I won't need to use a File Geodatabase in production.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Rhys,

  I actually don't cache any of my map services and achieve good performance. It all depends on your Server configuration, power, and network upload/download speeds. Now as far as your question, I don't know if that is the best route to go caching each layer but it would achieve what you are after allowing you to check and uncheck those in the TOC. You will definitely want to use a tile image type that supports transparency line PNG 24 or 32.
0 Kudos
RhysDonoghue
Deactivated User
Thanks for your advice Robert, it is very helpful.  I might not be able to do anything about improving the performance of our development server in the short term.  So in the meantime, I want to try the cached services.  Do you know of any examples where the TOC has a list of the services as opposed to layers?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Rhys,

   Can't say I do know of any example of this. Good luck with your demo.
0 Kudos