how to identify a dynamiclayer added on the fly

2564
1
Jump to solution
08-31-2015 01:45 PM
DuarteCarreira
Occasional Contributor II

Wondering if anyone knows how to identify a dynamiclayer as in a joindatasource layer?

The REST API has a DynamicLayers text box in the identify request where I can successfully get results from a layer that does not exist on the mapservice. You can see it here:

Identify (Census)

I just can't find a way to do this in Javascript. Do I really need to build the request manually? It seems weird... dynamiclayers exist since 10.1, I suppose there is a way in the JS API?

Thanks.

0 Kudos
1 Solution

Accepted Solutions
DuarteCarreira
Occasional Contributor II

Well this turned out to be very easy... but has some loopholes...

So, if you have already added your dynamiclayer to your map, this will be defined:

dynamicMapServiceLayer.dynamicLayerInfos

For the identify task to target your dynamiclayer, you have to put the above into the IdentifyParams:

identifyParams.dynamicLayerInfos = dynamicMapServiceLayer.dynamicLayerInfos;

The caveat: you cannot put anything in identifyParams.layerIds.

My understanding (for now) is that layerIds are for the original mapservice layers. If you need to identify  dynamiclayers you added on the fly *and* layers that were already in the mapservice, you should create 2 separate identifyTask.

So I hope this helps someone else... sorry I don't have a complete sample... theoretically a sample can be made using a dynamicMapService from esri that supports dynamic symbology.

View solution in original post

0 Kudos
1 Reply
DuarteCarreira
Occasional Contributor II

Well this turned out to be very easy... but has some loopholes...

So, if you have already added your dynamiclayer to your map, this will be defined:

dynamicMapServiceLayer.dynamicLayerInfos

For the identify task to target your dynamiclayer, you have to put the above into the IdentifyParams:

identifyParams.dynamicLayerInfos = dynamicMapServiceLayer.dynamicLayerInfos;

The caveat: you cannot put anything in identifyParams.layerIds.

My understanding (for now) is that layerIds are for the original mapservice layers. If you need to identify  dynamiclayers you added on the fly *and* layers that were already in the mapservice, you should create 2 separate identifyTask.

So I hope this helps someone else... sorry I don't have a complete sample... theoretically a sample can be made using a dynamicMapService from esri that supports dynamic symbology.

0 Kudos