Select to view content in your preferred language

Error/inconsistency - Dynamic service with only annotation not being properly ID'd

986
6
11-15-2011 05:04 AM
JeffPace
MVP Alum
Trying to confirm this. 

If you add a dynamic layer to a map, the div is id'd with map_layername, and then it contains a child image with the png in it with map_layername_randonumbers as the id

If you do the same on a mapservice that only contains annotation, the div does not get id'd, only the child image.

Is this a change/bug with 2.4/2.5? I have confirmed this was not the case with 2.2, and it makes it very difficult to get at the layers

thanks

http://www.mymanatee.org/arcgis/rest/services/common-operational/streetnames-for-aerials/MapServer

for a service with only annotation.
0 Kudos
6 Replies
derekswingley1
Deactivated User
What are you trying to do? We would normally recommend that you stick to using public API functions to interact with your layers. What is the API missing?
0 Kudos
JeffPace
MVP Alum
What are you trying to do? We would normally recommend that you stick to using public API functions to interact with your layers. What is the API missing?


I am using the public api, its for my own print function.  At 2.2, when you added a dynamic layer, it creates

<div id="map_layername"><img id="map_layername_randomnumber">/<img></div>


which is true at 2.5 as well, unless the service only has annotation, in which case, for some reason, the div does not get an id, only the img does.

For now i am just querying for the layers that only have annotation (i have to hardcode the names) and manually id'ing the divs. 

Just wondering why the change.
0 Kudos
derekswingley1
Deactivated User
Thanks for the clarification.

When I say "public API functions to interact with your layers" I'm talking about using the methods and properties documented in the official docs, not just the JS/CSS files hosted on Esri servers.

The finer points of the markup generated by the API isn't something we document and therefore is subject to change.

That being said, I tried to repro this using the URL you posted but I'm still seeing the layer's ID show up in the main div for a layer and in the img tag that inserts the map image into the map. Here's some of the markup generated from the code at the end of this post:

<div id="map_layers" class="layersDiv">
  <div id="map_layer0" style="position: absolute; left: 0px; top: 0px; width: 1354px; height: 521px; overflow: visible; display: block;">
  <div id="map_dynamic" style="position: absolute; left: 0px; top: 0px; width: 1354px; height: 521px; overflow: visible; opacity: 1; display: block;">
    <img id="map_dynamic_1321381345553" style="position: absolute; left: 0px; top: 0px; width: 1354px; height: 521px;" src="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/export?dpi=96&transparent=true&format=png8&bbox=-9181020.983518625%2C3176890.519266467%2C-9168084.016481375%2C3181868.480733533&bboxSR=102100&imageSR=102100&size=1354%2C521&f=image">
  </div>
  <div id="map_anno" style="position: absolute; left: 0px; top: 0px; width: 1354px; height: 521px; overflow: visible; opacity: 1; display: block;">
    <img id="map_anno_1321381345556" style="position: absolute; left: 0px; top: 0px; width: 1354px; height: 521px;" src="http://www.mymanatee.org/arcgis/rest/services/common-operational/streetnames-for-aerials/MapServer/export?dpi=96&transparent=true&format=png8&bbox=-9181020.983518625%2C3176890.519266467%2C-9168084.016481375%2C3181868.480733533&bboxSR=102100&imageSR=102100&size=1354%2C521&f=image">
...<snip>...


layer0 is a tiled basemap layer, dynamic is a dynamic map service hosted on sampleserver1 and anno is your map service. Here's the full page:

<!doctype html>
<html lang="en">
  <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" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/dojo/dijit/themes/tundra/tundra.css">
    <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/esri/dijit/css/Popup.css">
    <style>
      html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
      #map{ margin: 0; padding: 0; }
    </style>
    <script>var dojoConfig = { parseOnLoad: true };</script>
    <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5"></script>
    <script>
      dojo.require("dijit.layout.BorderContainer");
      dojo.require("dijit.layout.ContentPane");
      dojo.require("esri.map");
      
      var map;
      function init() {
        var initExtent = new esri.geometry.Extent({"xmin":-9177466,"ymin":3177315,"xmax":-9171639,"ymax":3181444,"spatialReference":{"wkid":102100}});
        map = new esri.Map("map",{extent:initExtent});
        var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");
        map.addLayer(basemap);
        
        var dyn = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer", {
          "id": "dynamic"
        });
        map.addLayer(dyn);

        var anno = new esri.layers.ArcGISDynamicMapServiceLayer("http://www.mymanatee.org/arcgis/rest/services/common-operational/streetnames-for-aerials/MapServer", {
          "id": "anno"
        });
        map.addLayer(anno);
        
        dojo.connect(map, 'onLoad', function() { 
          dojo.connect(dijit.byId('map'), 'resize', map, map.resize);
        });
      }
      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>
    </div>
  </body>
</html>
0 Kudos
JeffPace
MVP Alum
ok that is odd, i need to figure out why my code is not adding the id then.  thank you for double checking.
0 Kudos
derekswingley1
Deactivated User
Gladly. Please post back and let us know what you find.
0 Kudos
JeffPace
MVP Alum
Gladly. Please post back and let us know what you find.


Just wanted to report back i confirmed in your example it is being properly id'd, and in every test case (except my app) it behaves properly.  Baffling, ..
0 Kudos