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>
1
  • It simply wasn't zoomed to that specified level. Its working now :) Commented Nov 18, 2016 at 15:44

1 Answer 1

-1

//add like this:

map.layers.add([permitsLyr]);

1
  • 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. Commented May 5, 2017 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.