daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4.   <meta charset="utf-8">
  5.   <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
  6.   <title>Basemap Toggle</title>
  7.   <link rel="stylesheet" href="https://js.arcgis.com/3.23/esri/css/esri.css">
  8.   <style>
  9.     html, body, #map {
  10.       padding:0;
  11.       margin:0;
  12.       height:100%;
  13.     }
  14.     #BasemapToggle {
  15.       position: absolute;
  16.       top: 100px;
  17.       left: 20px;
  18.       z-index: 50;
  19.     }
  20.  
  21.     #MiMapaCacheado {
  22.       position: absolute;
  23.       top: 200px;
  24.       left: 20px;
  25.       z-index: 50;
  26.     }
  27.  
  28.   </style>
  29.   <script src="https://js.arcgis.com/3.23/"></script>
  30.   <script>
  31. var miMap;
  32. var miToggle;
  33. var miToggleCacheado;
  34.  
  35.  
  36. require([
  37.   "esri/basemaps",
  38.   "esri/map",
  39.   "esri/dijit/BasemapToggle",
  40.   "esri/dijit/BasemapToggle",
  41.   "esri/basemaps",
  42.   "dojo/domReady!"],
  43.   function( esriBasemaps, Map, BasemapToggle, BasemapToggleCacheado)
  44.       {
  45.  
  46.           esriBasemaps.oceanoCacheado = {baseMapLayers: [{url: "http://services.arcgisonline.com/arcgis/rest/services/Ocean_Basemap/MapServer"} ],
  47.               title: "Oceanos"
  48.             };
  49.  
  50.           miMap = new Map("map", {
  51.             center: [-70.6508, 43.1452],
  52.             zoom: 16,
  53.             basemap: "streets" });
  54.  
  55.           miToggle = new BasemapToggle({
  56.             map: miMap,
  57.             basemap: "satellite"
  58.           }, "BasemapToggle");
  59.           miToggle.startup();
  60.  
  61.  
  62.           miToggleCacheado = new BasemapToggleCacheado({
  63.             map: miMap,
  64.             basemap: "oceanoCacheado"
  65.           }, "MiMapaCacheado");
  66.           miToggleCacheado.startup();
  67.  
  68.  
  69.     }
  70.  );
  71.  
  72.   </script>
  73. </head>
  74. <body>
  75.   <div id="map" class="map">
  76.     <div id="BasemapToggle"></div>
  77.     <div id="MiMapaCacheado"></div>
  78.   </div>
  79. </body>
  80. </html>
  81.  
  82. /* paso 1  Definir Contenedor
  83.   paso 2 Requiere - function
  84.   paso 3 Crear Widget
  85.   paso 4 startup
  86.   */
RAW Paste Data
Top