Problem: Features are displayed and highlighted despite the scale factors set for the layer


The problem may arise in which features from a layer are displayed despite the scale factors set of a given layer. In other words, scale factors are set -- the 'minscale' and 'maxscale' attributes -- in the LAYER element of the Map Configuration File with intentions that the layer is to display when the map's scale is within a specified range. Instead, some or all features from the layer are drawn beyond this range. Also, the features are highlighted.


In the HTML Viewer, the dimensions of the requested image match those of the viewer’s map frame despite what a user draws as a zoom-in or zoom-out rectangle with the mouse. For basic image requests, the spatial server calculates the image envelope based on the longest dimension of the requested zoom rectangle. However, the portion of HTML Viewer code that highlights selected features performs its calculations based on the width dimension only. In some requests, therefore, the scale of this request is significantly different than that of the overall image. As a result, highlighted features might get added to or dropped from the map incorrectly.

Solution or Workaround

To resolve this problem, edit the 'addSelectToMap()' function so that it calculates the appropriate scale. The edited code will compare the aspect ratio of the zoom rectangle extent with the aspect ratio of the map.

  1. In a text editor, open 'aimsSelect.js' from ArcIMS/Website/<website_name>/javascript folder.
  2. Look for the following line in the file:


    function addSelectToMap(){

  3. Add the lines shown in bold below:


    function addSelectToMap(){
    var selString = "";
    var sFactor = (eRight-eLeft) / iWidth;
    var aspectRatio=iWidth/iHeight;
    var extentRatio=(eRight-eLeft)/(eTop-eBottom);
    if (extentRatio<aspectRatio) sFactor = (eTop-eBottom)/iHeight;
    if (((sFactor>=LayerMinScale[ActiveLayerIndex]) && (sFactor<=LayerMaxScale[ActiveLayerIndex])
    && (LayerVisible[ActiveLayerIndex]==1)) || (canSelectInvisible)) {

  4. Save the file.