A way to access a layer inside a map service without accessing it as a feature layer?

3988
22
Jump to solution
01-24-2013 10:39 AM
DougBrowning
MVP Esteemed Contributor
I want to access one layer of a map service to show it in a list.  I do not want to add it as a layer using /MapServer/0 in config.xml because then I lose the dynamic display properties that the /MapServer provides.  (The layer has 100,000 features so it blows up as a feature layer.) 

Can I get at it in a Map Service or is there a way to add a just layer in config.xml that is dynamic display wise?


Have tried many things. 

One was to publish a new map service each time but then there are so many map services the server bogs.

Second was to use setMaxAllowableOffset as in this post http://forums.arcgis.com/threads/49416-maxAllowableOffset-on-operationalLayers.  But the ZOOM_END does not seem to be firing in 3.1.  This blog post http://blogs.esri.com/esri/arcgis/2011/06/13/feature-layers-can-generalize-geometries-on-the-fly/ says that this concept is what ArcGIS Online does.


In the end all I want to do it be able to list layers multiple times, in multiple places, without having to create another Map Service all the time.  In other words granular control over how and where layers (not whole maps) are listed while still keeping the dynamic display properties). 

Concept: Kinda like ArcGIS Online where I am building a map up from multiple layers, each of which may be in a different map service.

Any ideas would be very appreciated, this has been struggled with for some time.

thanks
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Doug,

   Have you looked at LayerDefinitions and/or visibleLayers on the ArcGISDynamicMapServiceLayer?

http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/layers/ArcGISDynamicMapServiceLayer...

View solution in original post

0 Kudos
22 Replies
DougBrowning
MVP Esteemed Contributor
Is there a way to use sublayers for this?  So I can have the TOC display just one sublayer of a layer?

This would also allow a user to reorder the draw order of sublayers.
0 Kudos
AnthonyGiles
Honored Contributor
Doug,

I was wondering that myself but from what I have read I think sub layers are only used for creating different popup windows on each of your layers.

Have you tried feature layers with ondemand mode?

Regards

Anthony
0 Kudos
DougBrowning
MVP Esteemed Contributor
It looks like on demand mode just limits the features to the current extent.  The problem is all of these are national layers and I am sure people will turn them on at the national (US) scale often.  Zoomed in they are not that slow but full extent the browser can not even load all 100K features.

There must be a way because you can make just one layer of a map visible.  I am going to look into how the checkbox makes just one layer of the map visible.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Doug,

   Have you looked at LayerDefinitions and/or visibleLayers on the ArcGISDynamicMapServiceLayer?

http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/layers/ArcGISDynamicMapServiceLayer...
0 Kudos
DougBrowning
MVP Esteemed Contributor
Thanks this is really close.  Is this available in AS?  The mxml seems static. 

I am thinking I would make the TOC just like in ArcMap.  So I start with a empty TOC and Map (do not let the code load in the layers from the config.xml).  Then when the user clicks on a layer name (which is a sublayer) I then tell the TOC/Map to add that sub layer.

In other words the user click tells TOC to go ahead and load sublayer 0 of map service X.  (But do not load (or just not show) in the TOC say sublayer 1 of map service X)
0 Kudos
AnthonyGiles
Honored Contributor
Doug,

I know I directed you to ths widget before:

http://www.arcgis.com/home/item.html?id=4ed10ea387444952a3f3f501fee02b76

But did you have a look at it because this does something similar to what you are trying, it allows you to add / remove layers after the application has loaded (these can be individual feature layers from a map service if required).

Regards

Anthony
0 Kudos
DougBrowning
MVP Esteemed Contributor
Thanks a lot.

I looked at it briefly but I wanted a different UI.  Then when i hit the just one layer of a map service issue I had looked at so much stuff I forgot about it.

Looks promising.  But the issue I see is that it loads feature layers as /FeatureServer/0 but then they are not dynamically rendered like they are with /MapServer (at least if you say MapServer/0 they are not since they you have to say type feature not dynamic). 

I need to show one layer (sublayer) out of a MapServer in the TOC.  So tell it - in this Map Service just put this sublayer in the TOC.  Some of our Map Service have 190+ layers and I just want one of those - and since it has 103K polygons it needs to be dynamic.


Maybe I can edit that in...
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Doug,

   Sure anything you can do in MXML you can do in AS (as all MXML actually gets turned into AS when compiled). For the visibleLayers all you do is hand it a array of layer IDs that you want visible.
0 Kudos
DougBrowning
MVP Esteemed Contributor
Robert.   I then can change toc.categories to stop it from showing a tree nest structure right? 

I am guessing it will still show
     Map Service name ->
             Group Name ->
                    Layer Name
0 Kudos