agray7501

featureLayers in MapServices Drawing REALLY Slow.. Why?

Discussion created by agray7501 on Oct 5, 2010
Latest reply on Oct 12, 2010 by agray7501
I am working on creating an online map using ESRI mapservices as a basemap and existing mapservices on our arcserver.. The problem I am running into is that the mapservices we have here are really slow to draw.. They do draw however.

I have no access the mapservices themselves to change them only to reference them. What might be causing this issue? Below is my unfinished code for the page...

I am working on this using the ESRI Javascript API... Any help is greatly appreciated.

     dojo.require("dijit.layout.BorderContainer");
      dojo.require("dijit.layout.ContentPane");
      dojo.require("dijit.layout.AccordionContainer");
      dojo.require("esri.dijit.Legend"); 
      dojo.require("esri.map");
      dojo.require("esri.layers.FeatureLayer");
      dojo.require("dijit.form.Button");
      dojo.require("dijit.Dialog");
      dojo.require("esri.arcgis.utils");
      dojo.require("esri.toolbars.navigation");
      dojo.require("dijit.Toolbar");
    
      var mapLayers = [];
      var map;
       var legendLayers = [];
       var navToolbar;
      
       
      function init() {
        var extent = new esri.geometry.Extent({"xmin":-78.21364,"ymin":38.9500003,"xmax":-78.31262,
              "ymax":39.49891569,"spatialReference":{"wkid":4269}});
        map = new esri.Map("map", { extent: esri.geometry.geographicToWebMercator(extent)});
        dojo.connect(map, "onLoad", initOperationalLayer);
    
        var imagery = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer");
        map.addLayer(imagery);
        mapLayers.push(imagery);
      
      var usaTopo = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer");
      map.addLayer(usaTopo);
      mapLayers.push(usaTopo);
      
      var worldStreet = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
      map.addLayer(worldStreet);
      mapLayers.push(worldStreet);
      
      
      navToolbar = new esri.toolbars.Navigation(map);
        dojo.connect(navToolbar, "onExtentHistoryChange", extentHistoryChangeHandler);
            
      dojo.connect(map, "onExtentChange", showExtent);
      }
       
       
      function initOperationalLayer(map) {
        var parcelContent = "<br /><b>Owner</b>: ${CAMRAGIS.MLNAM}" +
                      "<br /><b>Rec#</b>: ${PARCEL.RECNUM}" +
           "<br /><b>Acres</b>: ${CAMRAGIS.MACRE#}";
            
           
      var buildingContent = "${ADDRESS}";
      var landuseContent = "${LAND_USE}";
      var zoningContent = "${ZONING}" + 
           "<br />${DESCRIPTIO}";
      
        var parcelInfo = new esri.InfoTemplate("Parcels", parcelContent);
      var buildingInfo = new esri.InfoTemplate("ADDRESS", buildingContent);
      var landuseInfo = new esri.InfoTemplate("Future Land Use", landuseContent);
      var zoningInfo = new esri.InfoTemplate("Zoning", zoningContent);
    
        var parcelLayer = new esri.layers.FeatureLayer("http://gis1.co.frederick.va.us/ArcGIS/rest/services/GeoDoc/MapServer/1",{
          mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
          displayOnPan:false,outFields: ["*"], opacity:.5, tileWidth:50, tileHeight:50, visible:false, maxScale:0, minScale:0,
          infoTemplate: parcelInfo
        });
      
      var streetsLayer = new esri.layers.FeatureLayer("http://gis1.co.frederick.va.us/ArcGIS/rest/services/GeoDoc/MapServer/2",{
          mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
          displayOnPan:false,outFields: ["*"], opacity:.8, tileWidth:50, tileHeight:50, visible:false, maxScale:0, minScale:0,
          
        });
      
      var buildingsLayer = new esri.layers.FeatureLayer("http://gis1.co.frederick.va.us/ArcGIS/rest/services/GeoDoc/MapServer/13",{
          mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
          displayOnPan:false,outFields: ["*"], opacity:.8, tileWidth:50, tileHeight:50, visible:false, maxScale:0, minScale:0,
          infoTemplate: buildingInfo
        });
      
      var landuseLayer = new esri.layers.FeatureLayer("http://gis1.co.frederick.va.us/ArcGIS/rest/services/GeoDoc/MapServer/20",{
          mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
          displayOnPan:false,outFields: ["*"], opacity:.8, tileWidth:50, tileHeight:50, visible:false, maxScale:0, minScale:0,
          infoTemplate: landuseInfo
        });
      
      var zoningLayer = new esri.layers.FeatureLayer("http://gis1.co.frederick.va.us/ArcGIS/rest/services/GeoDoc/MapServer/17",{
          mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
          displayOnPan:false,outFields: ["*"], opacity:.8, tileWidth:50, tileHeight:50, visible:false, minScale:0,
          infoTemplate: zoningInfo
        });
      
      map.addLayer(parcelLayer);
      map.addLayer(streetsLayer);
      map.addLayer(buildingsLayer);
      map.addLayer(landuseLayer);
      map.addLayer(zoningLayer);
           
        
        map.infoWindow.resize(200,150);
        
      mapLayers.push(parcelLayer);
      mapLayers.push(streetsLayer);
      mapLayers.push(buildingsLayer);
      mapLayers.push(landuseLayer);
      mapLayers.push(zoningLayer);
      
      
      legendLayers.push({layer:parcelLayer,title:"Parcels"});
      legendLayers.push({layer:streetsLayer,title:"Streets"});
      legendLayers.push({layer:buildingsLayer,title:"Buildings"});
      legendLayers.push({layer:landuseLayer,title:"Future Land Use"});
      legendLayers.push({layer:zoningLayer,title:"Zoning"});
      
       
      dojo.connect(map,'onLayersAddResult',function(results){
          var legend = new esri.dijit.Legend({
            map:map,
            layerInfos:legendLayers
          },"legendDiv");
          legend.startup();
        });        
     }
    
      function layerVisibility(layer) {
        (layer.visible) ? layer.hide() : layer.show();
      }
       
       function extentHistoryChangeHandler() {
        dijit.byId("zoomprev").disabled = navToolbar.isFirstExtent();
        dijit.byId("zoomnext").disabled = navToolbar.isLastExtent();
      }
       
       function showExtent(ext){
      var s = "";
       s = "XMin: " + ext.xmin.toFixed(2) +
          " YMin: " + ext.ymin.toFixed(2) +
          " XMax: " + ext.xmax.toFixed(2) +
          " YMax: " + ext.ymax.toFixed(2);
      dojo.byId("onExtentChangeInfo").innerHTML = s;
          }
    
      dojo.addOnLoad(init);
     
     

Outcomes