AnsweredAssumed Answered

Using layer.sublayer to reference Feature layers in MapImageLayer

Question asked by agelfert on Dec 12, 2018
Latest reply on Dec 17, 2018 by agelfert

So I have a Mapservice that consists of a number of Feature Layers. So at REST endpoint each service has a URL ending in... :

Mapserver/0
Mapserver/1
Mapserver/2
etc...

If I want to run some geometry operations on these FeatureLayers, I was hoping to create a new layer:

   
   let myLayer = new MapImageLayer({
         url : https://.........../MapServer"
   })

 

and then later, reference the underlying FeatureLayers as

 

   myLayer.findSubLayersById(...)

 

But that results in 'undefined'. Is such only possible after I reference each sublayer when creating myLayer, such as...

   let myLayer = new MapImageLayer({
      sublayers : [
         {id : 0},
         {id : 1},
      ]
   })
'
Or is there a simpler way to bring in all Feature layer and make them accessible? Can create list or collection of all feature layers and then reference them by index?

Outcomes