Problem displaying a tile layer with a feature layer

2515
2
06-20-2016 04:32 AM
MohamedHamoud
New Contributor II

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?

0 Kudos
2 Replies
UndralBatsukh
Esri Regular Contributor

Hi there,

You are running to this behavior because the LODs and the min/max scale values come from the 1st layer you add to the map.

0 Kudos
MohamedHamoud
New Contributor II

I modified the code to remove any scale restriction, but this didn't fix the issue:

 var view = new MapView({
container: "viewDiv",
map: map,
constraints: {
minScale: 0, 
maxScale: 0
 }
});







0 Kudos