base map

1365
14
Jump to solution
11-16-2017 10:10 AM
anjelinaponkerat
Occasional Contributor II

Hi

I,m going to add 4  arcgis web services(tiled), as a base map by toggle tools. but I can not do this. plese help me.

Regards

0 Kudos
1 Solution

Accepted Solutions
anjelinaponkerat
Occasional Contributor II

Tiled map service, arcgis 10.2.2

View solution in original post

14 Replies
RobertScheitlin__GISP
MVP Emeritus

Anjelina,

  The BaseMap Toggle dijit is intended for 2 basemaps. For 4 basemaps you need to use the BaseMap Gallery dijit.

0 Kudos
anjelinaponkerat
Occasional Contributor II

Hi

Do you have any sample code?

Regards

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Anjelina,

  Sure see this sample:

Basemap gallery | ArcGIS API for JavaScript 3.22 

anjelinaponkerat
Occasional Contributor II

I used this sample, but I dont know how to add my tiled web services instead of topo, satellite and other.... . I dont like esri basemap and open street, I,m going to use my own services that are from ArcGIS Server 10.2.2. please help me more.

Regards

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Anjelina,

  Here is a sample for custom basemaps and using the Basemap Gallery dijit: (attached is the images that this sample requires)

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
  <title>Display Multiple ArcGIS Online Services</title>
  <link rel="stylesheet" href="https://js.arcgis.com/3.22/dijit/themes/claro/claro.css">
  <link rel="stylesheet" href="https://js.arcgis.com/3.22/esri/css/esri.css">
  <style>
    html,
    body {
      height: 97%;
      width: 98%;
      margin: 1%;
    }

    #map {
      border: solid 1px #B5BCC7;
      padding: 0;
    }

    #paneHeader {
      background: url(images/header.png) repeat-x;
      color: white;
      border-bottom: solid 1px #B5BCC7;
      text-align: center;
      height: 30px;
      margin: 0;
      overflow: hidden;
      font-size: 16px;
      padding: 8px 5px;
    }

    #rightPane {
      width: 150px;
      margin: 0;
      padding: 0;
    }
  </style>

  <script src="https://js.arcgis.com/3.22/"></script>

  <script>
    var map;
    require([
      "esri/map", "esri/dijit/BasemapGallery",
      "dojo/parser", "esri/dijit/BasemapLayer", "esri/dijit/Basemap",
      "dijit/layout/BorderContainer", "dijit/layout/ContentPane",
      "dojo/domReady!"
    ], function(
      Map, BasemapGallery,
      parser, BasemapLayer, Basemap
    ) {
      parser.parse();

      map = new Map("map");

      var basemaps = [];
      var waterTemplateLayer = new BasemapLayer({
        url: "https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/WaterTemplate/LocalGovernmentInfrastruct..."
      });
      var waterBasemap = new Basemap({
        layers: [waterTemplateLayer],
        title: "Water Template",
        thumbnailUrl: "images/waterThumb.png"
      });
      basemaps.push(waterBasemap);
      var publicSafetyLayer = new BasemapLayer({
        url: "https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyBasemap/MapServ..."
      });
      var publicSafetyBasemap = new Basemap({
        layers: [publicSafetyLayer],
        title: "Public Safety",
        thumbnailUrl: "images/safetyThumb.png"
      });
      basemaps.push(publicSafetyBasemap);

      var basemapGallery = new BasemapGallery({
        showArcGISBasemaps: false,
        basemaps: basemaps,
        map: map
      }, "basemapGallery");
      basemapGallery.startup();

      basemapGallery.on("error", function(error) {
        console.log(error);
      });
    });
  </script>

</head>

<body class="claro">
  <div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline', gutters:true" style="width:100%;height:100%;">

    <div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">
    </div>

    <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'right'" id="rightPane">

      <div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline', gutters:false" style="width:100%;height:100%;">
        <div id="paneHeader" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'">
          <span>Select Basemap</span>
        </div>
        <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">
          <div id="basemapGallery"></div>
        </div>
      </div>
    </div>
  </div>
</body>

</html>
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
anjelinaponkerat
Occasional Contributor II

Hi

This sample can not load secured web services!!! What changes I have to apply in your code?

Regards

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Anjelina,

   What do you mean exactly that you cannot load secured web service? Secured web service should work in the code without any changes, assuming that the user has appropriate permissions to the service when they are prompted to login.

0 Kudos
anjelinaponkerat
Occasional Contributor II

Yes, I can not load secured web services and the page has not login page!!! 

If I add token after web service in my code the service load ok, if not dont load!!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

What type of service are you attempting to add? When I add a secured map service I have no problem with the Identity manger login dialog to appear automatically.

0 Kudos