Skip to main content
1 of 2
MattiasSp
  • 328
  • 3
  • 8

One idea would be to hide the WMSLayer entirely if the map's extent is outside the layers "valid" extent.

Based on this answer, one could listen to the map's extent-change event and check if the map's current extent is acceptable:

map.on("extent-change", function () {
    // Check if map.extent is acceptable, otherwise hide the WMSLayer.
    if ((map.extent.xmin < maxExtent.xmin) ||
        (map.extent.ymin < maxExtent.ymin)  ||
        (map.extent.xmax > maxExtent.xmax) ||
        (map.extent.ymax > maxExtent.ymax)) {
        // Hide the WMSLayer.
    }
}

This would not allow the WMSLayer to cover the map partially though.

The same idea could be applied using a server proxy as well.

MattiasSp
  • 328
  • 3
  • 8