0

I am trying to load the regions from here http://apps.geoportal.icimod.org/ArcGIS/rest/services/Nepal/VDC/MapServer, but nothing is showing up.

Is there something wrong with my code?

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1,maximum-scale=1,userscalable=no">
  <title>MapImageLayer - 4.1</title>
  <link rel="stylesheet" href="https://js.arcgis.com/4.1/esri/css/main.css">
  <script src="https://js.arcgis.com/4.1/"></script>
  <style>
    html,
    body,
    #viewDiv {
      padding: 0;
      margin: 0;
      height: 100%;
      width: 100%;
    }
  </style>
  <script>
        require([
        "esri/Map",
        "esri/views/MapView",
        "esri/layers/MapImageLayer",
        "dojo/domReady!"
      ],
      function(
        Map, MapView, MapImageLayer
      ) {
            var permitsLyr = new MapImageLayer({
      //vdc
          url: "http://apps.geoportal.icimod.org/ArcGIS/rest/services/Nepal/VDC/MapServer"
     });

    /*****************************************************************
     * Add the layer to a map
     *****************************************************************/
        var map = new Map({
          // basemap: 'streets', 
          layers: [permitsLyr]
        });

        var view = new MapView({
          container: "viewDiv",
          map: map
        });

    /*****************************************************************
     * Animate to the layer's full extent when the layer loads.
     *****************************************************************/
        permitsLyr.then(function() {
          view.goTo(permitsLyr.fullExtent);
        });
      });
  </script>
</head>
<body>
   <div id="viewDiv"></div>
</body>
</html>
  • It simply wasn't zoomed to that specified level. Its working now :) – Sabbiu Shah Nov 18 '16 at 15:44
-1

//add like this:

map.layers.add([permitsLyr]);

  • Welcome to GIS SE! As a new user please take the tour. A good answer should include an explanation of how and where to use your solution, and details of what it does to solve the problem raised in the Question. – Midavalo May 5 '17 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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