Select to view content in your preferred language

JMap and Layer Packages

3296
4
Jump to solution
04-02-2013 11:07 AM
CarlosColón-Maldonado
Frequent Contributor
Greetings,

I have a requirement to display only footprints as layers on a map legend in an application tool that depicts what is contained in a geodatabase using mosaic data sets that each reference a variety of raster types in a workspace. This tool must display these different footprint layers on a legend fashion, while the application must display only the image layers also in a legend fashion. I do not need to display the boundary layers that each mosaic data sets auto-generate. I have to allow the user to select/deselect each layer for viewing via the legend, in both the application and the tool.

I've noticed that map package layers on a JMap object do not provide their containing sub-layers, but each is added and treated as a sole layer in a legend. I've convinced myself that the layers created by a mosaic data set must be individually packaged and loaded unto the JMap in order for them to be visible by the legend.

I've searched for a way to do this. Which component in he API is used to load a layer package (.lpk) unto the map? Or, is there a way to expose the grouped sub-layers of a map package unto the legend so I wouldn't have to package all of the mosaic data sets sub-layers?

Thanks in advanced.
0 Kudos
1 Solution

Accepted Solutions
EliseAcheson1
Deactivated User
Hi Carlos,

I created a map package from a mosaic dataset, added it to a map (JMap) as a local dynamic layer, then created a legend (JLegend) using this map. The legend displays the layers of the map package (Boundary, Footprint, Image in my case) and also allows me to toggle the visibility of each of these layers, once I expanded the 'Layers' legend item by clicking on the little blue circle icon on the left side. 

Is this what you are after?

I'm including an image of the resulting application displaying the mpk layer and the legend. The bottom image is showing the visibility toggling of the Footprint layer as an example.

[ATTACH=CONFIG]23202[/ATTACH]

~elise

View solution in original post

0 Kudos
4 Replies
MarkBaird
Esri Regular Contributor
Hi Carlos,

Have you looked at the toolkit section of the sample application where we have created a few different legend examples.

If they do what you want (or even get close) the code for all these toolkit components is there for you do see - we've just used the raw API to create these.

Mark
0 Kudos
CarlosColón-Maldonado
Frequent Contributor
Hi Mark,

Yes, I have and I've seen the code. These are essentially trees that list the Tiled map service layers, Dynamic map service layers, Feature layers and/or Graphics layers loaded programmatically unto the JMap. They do not list the sublayers of a mosaic data set being displayed.

For example, I can toggle the visibility of the Boundary, FootPrint and Image sublayers from a map document that displays a mosaic dataset with loaded raster data in ArcMap. If I create a map package of this map document and use it on either of these legend examples, I will not see these sublayers, but a single layer represented by the map package itself.

ArcMap only gives me the option of creating layer packages (lpk) off each individual sublayer. So, my question really boils down to whether Runtime can display lpk files. If not, how viable of an option it would be to make separate map packages with different visibility settings (display only the FootPrint sublayer on one and only the Image on the other). A better recourse would certainly be to have the ability to access these sublayers of a map package. What's your take?

Carlos
0 Kudos
EliseAcheson1
Deactivated User
Hi Carlos,

I created a map package from a mosaic dataset, added it to a map (JMap) as a local dynamic layer, then created a legend (JLegend) using this map. The legend displays the layers of the map package (Boundary, Footprint, Image in my case) and also allows me to toggle the visibility of each of these layers, once I expanded the 'Layers' legend item by clicking on the little blue circle icon on the left side. 

Is this what you are after?

I'm including an image of the resulting application displaying the mpk layer and the legend. The bottom image is showing the visibility toggling of the Footprint layer as an example.

[ATTACH=CONFIG]23202[/ATTACH]

~elise
0 Kudos
CarlosColón-Maldonado
Frequent Contributor
YES!!

It turns out that the JLegend does make the inner layers of a ArcGISLocalDynamicMapServiceLayer object visible and selectable once loaded on the JMap.

Thanks.
0 Kudos