Select to view content in your preferred language

"copyright" property of layers

1063
3
Jump to solution
05-12-2010 07:37 AM
LisaHallberg
New Contributor
I am trying to access the "copyright" property of ESRI's ArcGISTiledMapServiceLayer (http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer) and I can't seem to see it.

Can someone confirm for me that this property is working in v1.6 of the API?

Thanks.
0 Kudos
1 Solution

Accepted Solutions
DerekSwingley
Regular Contributor
OK, thanks for the additional info. If that's what you're looking for, then you specify service.copyright, not copyrightText. This works for me: 
dojo.connect(map, "onLoad", function() {dojo.byId('copyright').innerHTML = service.copyright; } );

View solution in original post

0 Kudos
3 Replies
DerekSwingley
Regular Contributor
You mean copyrightText? This is with 2.0 but it should work with 1.6 too:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title> Topographic Map</title>
    <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.0/js/dojo/dijit/themes/tundra/tundra.css">
    <style>
      html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
    </style>
    <script type="text/javascript">var djConfig = {parseOnLoad: true};</script>
    <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.0"></script>
    <script type="text/javascript">
      dojo.require("dijit.layout.BorderContainer");
      dojo.require("dijit.layout.ContentPane");

      function init() {
        esri.request({
          'url': 'http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer',
          'content': { 'f': 'json' },
          'callbackParamName': 'callback',
          'load': function(data) { 
            dojo.byId('copyright').innerHTML = data.copyrightText;
          },
          'error': function(error) { console.log(error); }
        });
      }

      dojo.addOnLoad(init);
    </script>
  </head>
  
  <body class="tundra">
    <div id="copyright">
      getting copyright info...
    </div>
  </body>
</html>
0 Kudos
LisaHallberg
New Contributor
I'm looking at this documentation:
http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jsapi_start.htm#jsapi/ar...

For the Tiled and Dynamic layer types, it suggests that I should be able to refer to the "copyright" property of the service.

However, if I do the following, neither the "copyright" nor "copyrightText" properties are defined. The code example you sent before worked fine.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title> Topographic Map</title>
    <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/1.6/js/dojo/dijit/themes/tundra/tundra.css">
    <style>
      html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
    </style>
    <script type="text/javascript">var djConfig = {parseOnLoad: true};</script>
    <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.6"></script>
    <script type="text/javascript">
      dojo.require("dijit.layout.BorderContainer");
      dojo.require("dijit.layout.ContentPane");

   var map, service;
   
      function init() {
   
    service = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer", { opacity: 1 } ); 
  map = new esri.Map("map", { nav: true, displayGraphicsOnPan: false, 
   extent: new esri.geometry.Extent( {xmin:-102.42486076944752, xmax:-94.2168412305526, ymin:35.75871499385985, ymax:41.23753400614044, spatialReference:new esri.SpatialReference( {wkid:4326} ) } ) } );
  map.addLayer(service); 
  dojo.connect(map, "onLoad", function() {dojo.byId('copyright').innerHTML = service.copyrightText; } );
  
      }

      dojo.addOnLoad(init);
    </script>
  </head>
  
  <body class="tundra">
   <div id="map"></div>
    <div id="copyright">
      getting copyright info...
    </div>
  </body>
</html>
0 Kudos
DerekSwingley
Regular Contributor
OK, thanks for the additional info. If that's what you're looking for, then you specify service.copyright, not copyrightText. This works for me: 
dojo.connect(map, "onLoad", function() {dojo.byId('copyright').innerHTML = service.copyright; } );
0 Kudos