AnsweredAssumed Answered

FeatureLayer can't be added to two maps in JS API v4.0

Question asked by jay.gregory on Nov 29, 2016
Latest reply on Nov 29, 2016 by jay.gregory

I'm playing around with v4.0 of the API, and noticed that a feature layer can only be added to a single Map.  My app has both a SceneView and a MapView (the views are toggled in the same div with a button), each with a separate corresponding Map object.  

I can add my FeatureLayer to my Map for my MapView, and it shows up.  

If I try to add my FeatureLayer to my Map for my SceneView, it will remove the layer from my Map/MapView and add it to my Map/SceneView.  

The only way I can add a layer to both a MapView and SceneView at the same time (i.e. syncing layers across two maps/map views) is essentially cloning the FeatureLayer (or creating a new one) and adding the second one to the second view.  Seems laborious and unnecessary because now my app has to keep track of two FeatureLayers that are exactly the same, just to get them to appear in two different views.  Is this by design or am I doing something wrong?