Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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);
share|improve this question
    
Are the layers cached or dynamic? –  Michael Todd Oct 5 '10 at 15:02
    
using a number of layers in a dynamic mapservice.. –  Not to be named Oct 5 '10 at 18:06
1  
Does using just one dynamic layer (and no tiled layers) resolve the slowness issue, i.e. is it acceptably faster (don't try the parcel layer with this test; maybe the streets layer). If so, it might be that you're just trying to draw too many things dynamically and will have to resort to using tiled layers. See our published services at breccia.ccrfcd.org/ArcGIS/rest/services for reference. –  Michael Todd Oct 5 '10 at 19:05
add comment

1 Answer 1

up vote 2 down vote accepted

are all of the dynamic map services in the same coordinate system, the reason I ask is because the "On the Fly Projection" is a process which slows down the visualisation.

share|improve this answer
    
I changed the initialExtent to be equal to that of the mapservice we have in-house.. I also, took out the ESRI basemap Services so that I should only see the mapservice layers I am referencing. var initialExtent = new esri.geometry.Extent({ "xmin" : 11421300.5349158, "ymin":7020613.11474527, "xmax":11651261.340194, "ymax":7256266.01916407, "spatialReference": {"wkid":2283}}); map = new esri.Map("map", {extent: initialExtent}); –  Not to be named Oct 6 '10 at 14:41
    
now I see nothing. –  Not to be named Oct 6 '10 at 14:54
    
I had a look at the REST Services statement and it seems that you have some data in WGS84 (based on their naming convention). Google Earth is based on Web Mercator, as such if you convert your data into Web Mercator then you will see something with the new extent parameters and the services will speed up –  CDBrown Oct 7 '10 at 0:19
    
You and Michael Todd gave me some great help and I think headed me in the right direction.. I created a new mapservice and had all the data in there projected to web mercator. Then JGrayson on ESRI forum suggested I use sublayers from the dynamicmapservicelayer by setting the layers within the mapservice 'setVisibleLayers'.. that worked great.. now I've gone and added the navigation toolbar and the basemapGallery to the map. Its still a bit slow though but have a look. I am now having a problem with the redraw.:( www.co.frederick.va.us/planning/newmap6.html –  Not to be named Oct 7 '10 at 20:26
    
Both www.co.frederick.va.us/planning/newmap6.htm and www.co.frederick.va.us/planning/newmap6.html threw a 404 error. Did you move it already? Or are you not having redraw issues any more? (Also, you may want to open up a new question with this issue, since "talking" in comments is sometimes non-productive, and asking a question usually brings a broader audience into the issue.) –  Michael Todd Oct 8 '10 at 21:04
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.