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.

It's possible to add a layer as a basemap in ArcGIS.com by checking the check box use as baselayer:

Use as base Layer

But when I consume the map using:

var mapDeferred = esri.arcgis.utils.createMap("<guid>", "map", {
                mapOptions: {
                    slider: true,
                    nav: false
                }
            });

the basemap don't show up, is there any rules that define what content can be used as a basemap?

share|improve this question
    
one quick question, after u added the required Web Service as basemap, were you able to customize it and enable popups on it? In the same manner as we can do when we add a simple shapefile and then enable popups on it. I tried but it seems that if you want to add a shapefile as a basemap, the enable popup feature is no more available. This is the question that I posted, gis.stackexchange.com/questions/31825/… –  Sam007 Aug 20 '12 at 21:58
add comment

1 Answer 1

up vote 6 down vote accepted

Yes, this is definitely possible, here's an example:

<!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");
      dojo.require("esri.arcgis.utils");

      var map;
      esri.config.defaults.geometryService = new esri.tasks.GeometryService('http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer');
      function init() {
        var agol_map = new esri.arcgis.utils.createMap("c11215b898ec46369f855c82b28fc65e", "map", {
          mapOptions: {
            slider: true,
            nav:false
          }
        });
        agol_map.addCallback(function(response) {
          // Keep a reference to the map
          map = response.map;

          dojo.connect(dijit.byId('map'), 'resize', 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>

Update: The key is to add a default geometry service:

esri.config.defaults.geometryService = new esri.tasks.GeometryService('http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer');
share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.