mhmdh2000

Problem displaying a tile layer with a feature layer

Discussion created by mhmdh2000 on Jun 20, 2016
Latest reply on Jun 21, 2016 by mhmdh2000

I am facing a strange behavior using Java script API 4.0. I have two layers to display, one is a tile layer and the other one is a feature layer. When I add the tile layer at the bottom, then I can't zoom in to all levels, but when I add the tile layer at the top every thing goes well but of curse the feature layer will not be visible.

 

Below is the code that cause the problem:

var MyFeatureLayer = new FeatureLayer({
    
url: "http://*******/MapServer"

});

var MyTileLayer = new TileLayer({
    
url: "http://*******/MapServer"

});

  var map = new Map({
  
layers: [MyTileLayer, MyFeatureLayer]

  });





















 

If I changes the order when adding the layers it works, but the tile layer will hide the feature layer:

  var map = new Map({
      layers: [MyFeatureLayer, MyTileLayer]
  });





Any Idea?

Outcomes