Select to view content in your preferred language

Level of details  (LOD) for dynamic layer

1231
5
Jump to solution
10-16-2012 04:13 AM
SunilPalkar
Deactivated User
Hi

I am working on Dynamic layers and I want to make similar example  @ http://help.arcgis.com/en/webapi/javascript/arcgis/samples/map_switch_layer_on_zoom/index.html

I know its possible in Tiled map service but I am using ArcGIS Online (as base map) and two dynamic services on top of ArcGIS Online and  in API reference (3.0) its not mentioned so any help will be great !!

Thank you..
0 Kudos
1 Solution

Accepted Solutions
SunilPalkar
Deactivated User
Thanks for your reply..I am working on your idea..

Also I think that I can set zoom levels in desktop itself (BCoz those .mxd's are available in Desktop 10.0) so let you know soon something good : )


Hi,

EDIT:  I think that is better to use the property setMinScale(scale) and setMaxScale(scale) for your Dynamic layers. This methods are avaiable from 3.1

View solution in original post

0 Kudos
5 Replies
DavideLimosani
Frequent Contributor
Hi,

EDIT:  I think that is better to use the property setMinScale(scale) and setMaxScale(scale) for your Dynamic layers. This methods are avaiable from 3.1
0 Kudos
SunilPalkar
Deactivated User
Thanks for your reply..I am working on your idea..

Also I think that I can set zoom levels in desktop itself (BCoz those .mxd's are available in Desktop 10.0) so let you know soon something good : )


Hi,

EDIT:  I think that is better to use the property setMinScale(scale) and setMaxScale(scale) for your Dynamic layers. This methods are avaiable from 3.1
0 Kudos
SunilPalkar
Deactivated User
Hello,

I tried 1st in ArcMap (Save msd file with custom zoom)  and updated existing service still  its not working..

Tried  2nd way : inserted the properties in  as per mention in API (3.2) doc.

Here is the code
  
       
var dynamicMapServiceLayer1 = new esri.layers.ArcGISDynamicMapServiceLayer("http://my server:6080/arcgis/rest/services/layer11/MapServer",{"opacity":0.25});
       
     
         dynamicMapServiceLayer1.setVisibleLayers([0,1]);
          dynamicMapServiceLayer1.maxScale = 3000.988; // confirmed this scale in RESET api
          dynamicMapServiceLayer1.minScale = 1.479;   // confirmed this scale in RESET api
              
      
        map.addLayer(dynamicMapServiceLayer1);


Any more workaround will  great !!

thanks in advance..
0 Kudos
SunilPalkar
Deactivated User
Hi All,

I have one question regarding dynamic layer that

what is the exact scale of particular dynamic service ?

>> because I check the REST service for details its showing different value and I tried using
 var currentScale = map.getScale();
  console.log('Scale: ' + currentScale); 
its showing different scale.

>>After that I have used the following code
var dynamicLayerInfo = new esri.layers.DynamicLayerInfo({
        "defaultVisibility":true,
        "id":0,"maxScale":1000000,
        "minScale":0,
        "parentLayerId":-1
});
its showing some different value.

As per mention the API doc.

How should I proceed ? I want to apply LOD for dynamic layer
0 Kudos
SunilPalkar
Deactivated User
Hello All,

I followed following post and its resolved : )

Thanks every one and Kelly H & Derek.

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
    <title></title>
    <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.1/js/dojo/dijit/themes/tundra/tundra.css" />
    <style>
      html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
      h3 { margin: 0 0 5px 0; border-bottom: 1px solid #444; text-align: center }
      .shadow {
        -moz-box-shadow: 0 0 5px #888;
        -webkit-box-shadow: 0 0 5px #888;
        box-shadow: 0 0 5px #888;
      }
      #map{ margin: 0; padding: 0; }
      #feedback {
        background: #fff;
        color: #444;
        position: absolute;
        font-family: arial;
        height: 40px;
        left: 30px;
        margin: 5px;
        padding: 10px;
        bottom: 30px;
        text-align: center;
        width: 320px;
        z-index: 40;
      }
      .note { font-size: 80%; padding: 0 0 10px 0; }
      #slider {
        color: #666;
        margin: 5px auto;
        padding: 3px;
      }
      #appSliderLabel { padding: 0 0 10px 0; }
      #maxLabel { display: inline-block; margin: 0 0 0 -30px;}
      #minLabel { display: inline-block; margin: 0 0 0 30px;}
      #breakInfo { padding: 20px 0 0 0; }
     
    </style>
    <script>var dojoConfig = { parseOnLoad: true };</script>
    <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.1"></script>
    <script>
      dojo.require("dijit.layout.BorderContainer");
      dojo.require("dijit.layout.ContentPane");
      dojo.require("esri.map");

      // one global for persistent app variables
      var app = {};

      function init() {
        var ext, basemap, usaUrl;       
        ext = new esri.geometry.Extent({"xmin":-14332474,"ymin":3248843,"xmax":-8070752,"ymax":5464906,"spatialReference":{"wkid":102100}});
       
        app.map = new esri.Map("map", {
          "extent": ext,
          "slider": false
        });
        dojo.connect(app.map, "onLoad", function() {
          dojo.connect(dijit.byId("map"), "resize", app.map, app.map.resize);
          dojo.connect(app.map, "onZoomEnd", updateScale);
          updateScale();
        });

        basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer");
        app.map.addLayer(basemap);

        // set up a layer to show counties as a dynamic map service
        // set visible layers to [2]
        usaUrl = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer";
        app.usaLayer = new esri.layers.ArcGISDynamicMapServiceLayer(usaUrl, {
          "id": "usa",
          "opacity": 0.7
        });
        dojo.connect(app.usaLayer, "onLoad", function() {
          app.usaLayer.setVisibleLayers([2]);
          app.usaLayer.maxScale = 10000000;
          app.usaLayer.minScale = 20000000;
          // console.log("set dyn layer infos...", infos);
        });
        app.map.addLayer(app.usaLayer);
      }

      function updateScale() {
        dojo.byId("map-scale").innerHTML = dojo.number.format(parseInt(app.map.getScale()));
      }

      function errorHandler(err) {
        console.log('Oops, error: ', err);
      }

      dojo.ready(init);
    </script>
  </head>

  <body class="tundra">
    <div data-dojo-type="dijit.layout.BorderContainer"
         data-dojo-props="design:'headline',gutters:false"
         style="width: 100%; height: 100%; margin: 0;">
      <div id="map"
           data-dojo-type="dijit.layout.ContentPane"
           data-dojo-props="region:'center'">

        <div id="feedback" class="shadow">
          Map scale: <span id="map-scale">unknown</span>
        </div>
      </div>
    </div>
  </body>
</html>
0 Kudos