confused over what is meant by a "layer"

567
6
11-04-2011 01:59 AM
AdrianMarsden
Occasional Contributor III
OK on the desktop this is simple, a layer is a discrete data set, a shapefile, a layer in a geodatabase or something.

However it seems to me to have two usages for the Javascript API.  Take this  from http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm

"This sample shows how to use the Legend widget to build a legend that displays swatches and labels for the layers in the map.................The legend is displayed in one pane of the accordion container and a link that allows you to toggle the visibility of layers in the map is displayed in the other"

In the instance of "layers" this refers to the discrete datasets on the map, in this example, Campgrounds, Shelters, Earthquakes etc, and refers to the legend items for each of these "layers"

The second instance refers to map services added by "map.addLayers" and will give a tick box per map service - which could contain shed loads of, what I would call, "layers"

Have I missed something here? 

ACM
0 Kudos
6 Replies
HemingZhu
Occasional Contributor III
OK on the desktop this is simple, a layer is a discrete data set, a shapefile, a layer in a geodatabase or something.

However it seems to me to have two usages for the Javascript API.  Take this  from http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm

"This sample shows how to use the Legend widget to build a legend that displays swatches and labels for the layers in the map.................The legend is displayed in one pane of the accordion container and a link that allows you to toggle the visibility of layers in the map is displayed in the other"

In the instance of "layers" this refers to the discrete datasets on the map, in this example, Campgrounds, Shelters, Earthquakes etc, and refers to the legend items for each of these "layers"

The second instance refers to map services added by "map.addLayers" and will give a tick box per map service - which could contain shed loads of, what I would call, "layers"

Have I missed something here? 

ACM


Layer in JS API refers to a map services(.mxd/.msd) the runs at the ArcGIS server, except that you can define a certain layer in a map service as stand alone featurelayer.
0 Kudos
AdrianMarsden
Occasional Contributor III
Cheers - but this isn't consistent, for example .visibleLayers returns the visible discrete datalayers within a ArcGISDynamicMapServiceLayer

So I'm still confused!
0 Kudos
HemingZhu
Occasional Contributor III
Cheers - but this isn't consistent, for example .visibleLayers returns the visible discrete datalayers within a ArcGISDynamicMapServiceLayer

So I'm still confused!


Maybe they should use a better term...
0 Kudos
JeffPace
MVP Alum
I agree, but even your initial description is not correct.

A layer is NOT 
a discrete data set, a shapefile, a layer in a geodatabase or something
.  Those are tables, feature classes, etc.  A layer is a Feature Class,etc. with its associated symbology.

If you look at it this way, the AGS api makes more sense, but not completely.  They intermix the term layer for both a map service (mxd/msd) and its component sublayers as both generically layers.

And to add to that, if a map service is cached, its a single layer according to the application.  It is only the dynamic services that have sublayers that you can interact with.
0 Kudos
AdrianMarsden
Occasional Contributor III
You're quite right, of course, my definition was a bit short of a true definition of "layer" as used by the desktop.

But I'm glad to see in general I am not alone in thinking better terms should have been chosen at te start of the API - I can't see any way it will change now.
0 Kudos
derekswingley1
Frequent Contributor
I think you're getting bogged down in semantics. True, layer is a generic, over-used (abused?) term but if you look at the context in which it is used, I think you'll find the meaning is clear.
0 Kudos