Gibco basemap not being visualized

579
4
07-18-2018 11:40 PM
kishorekumar1
New Contributor II

Dear Sir,

                      I was using the Gibco basemap with the url: "https://maps.ngdc.noaa.gov/arcgis/rest/services/web_mercator/gebco_2014_hillshade/MapServer"   as my basemap in our applciation which is developed using "ArcGIS api for javascript ".But now i am not able to view the basemap. But,when i view the service in arcgis online i am able to view the Gibco basemap.But it is failing using arcgis api for javascript. Can any one help me in this regard

Regards,

Kishore Kumar

0 Kudos
4 Replies
KenBuja
MVP Honored Contributor

Can you post your code?

0 Kudos
kishorekumar1
New Contributor II

Dear Ken,

                      Below I am posting my code.Kindly refer it.

<!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>Simple Map</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.25/esri/css/esri.css">
<style>
html, body, #map {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<script src="https://js.arcgis.com/3.25/"></script>
<script>
var map;

require(["esri/map","esri/dijit/Basemap",
"esri/dijit/BasemapLayer", "dojo/domReady!"], function(Map,Basemap, BasemapLayer) {

var lyrGEBCO = new BasemapLayer(

{ url : "https://maps.ngdc.noaa.gov/arcgis/rest/services/web_mercator/gebco_2014_hillshade/MapServer"
//url : "https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"
});

var bmapGEBCO = new Basemap ({ layers : [ lyrGEBCO ],
title : "GEBCO",
thumbnailUrl : "images/mgs_gebco.png"
});
map = new Map("map", {
basemap: bmapGEBCO, //For full list of pre-defined basemaps, navigate to http://arcg.is/1JVo6Wd
center: [-122.45, 37.75], // longitude, latitude
zoom: 13
});
});
</script>
</head>

<body>
<div id="map"></div>
</body>
</html>

Regards,

Kishore Kumar

0 Kudos
KenBuja
MVP Honored Contributor

You cannot use a dynamic service as a basemap in the map constructor. This code works for tiled services

<!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>Simple Map</title>
  <link rel="stylesheet" href="https://js.arcgis.com/3.25/esri/css/esri.css">
  <style>
    html,
    body,
    #map {
      height: 100%;
      margin: 0;
      padding: 0;
    }
  </style>
  <script src="https://js.arcgis.com/3.25/"></script>
  <script>
    var map;

    require(["esri/map", "esri/basemaps", "dojo/domReady!"], function (Map, esriBasemaps) {

      //var lyrGEBCO = new BasemapLayer(

      //{ url : "https://maps.ngdc.noaa.gov/arcgis/rest/services/web_mercator/gebco_2014_hillshade/MapServer"
      //url : "https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"
      //});

      //var bmapGEBCO = new Basemap ({ layers : [ lyrGEBCO ],
      //title : "GEBCO",
      //thumbnailUrl : "images/mgs_gebco.png"
      //});

      // esriBasemaps.gebco = {
      //   baseMapLayers: [{ url: "https://maps.ngdc.noaa.gov/arcgis/rest/services/web_mercator/gebco_2014_hillshade/MapServer"}
      // ],
      //   thumbnailUrl: "https://www.example.com/images/thumbnail_2014-11-25_61051.png",
      //   title: "GEBCO"
      // };

      // map = new Map("map", {
      //   basemap: gebco, //For full list of pre-defined basemaps, navigate to http://arcg.is/1JVo6Wd
      //   center: [-122.45, 37.75], // longitude, latitude
      //   zoom: 13
      // });
      esriBasemaps.gebco = {
        baseMapLayers: [{ url: "https://services.arcgisonline.com/ArcGIS/rest/services/Specialty/DeLorme_World_Base_Map/MapServer" }
        ],
        thumbnailUrl: "https://www.example.com/images/thumbnail_2014-11-25_61051.png",
        title: "Delorme"
      };

      var map = new Map("map", {
        basemap: "gebco",
        center: [-111.879655861, 40.571338776], // long, lat
        zoom: 13,
        sliderStyle: "small"
      });

    });
  </script>
</head>

<body>
  <div id="map"></div>
</body>

</html>

Take a look at this post for one way to use a dynamic service in the Basemap Gallery

KenBuja
MVP Honored Contributor

That service also doesn't appear to be showing anything. It's not getting visualized in the AGOL Map Viewer

0 Kudos