ArcGIS JavaScript Tutorials: Create a Starter App




<html>
<head>
  <meta name="description" content="DevLabs - Get driving directions">
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
  <title>ArcGIS JavaScript Tutorials: Create a Starter App</title>
  <style>
    html, body, #viewDiv {
      padding: 0;
      margin: 0;
      height: 100%;
      width: 100%;
    }
    /* ADD */
    .esri-view .esri-directions {
      position: fixed;
      right: 15px;
      max-height:calc(100% - 45 px) !important;
    }
    .esri-view .esri-component.esri-attribution {
      position: fixed;
    }
  </style>
 
  <link rel="stylesheet" href="https://js.arcgis.com/4.13/esri/css/main.css">
  <script src="https://js.arcgis.com/4.13/"></script>
  <script>  
    require([
      "esri/Map",
      "esri/views/MapView",
      "esri/widgets/Directions"
    ], function(Map, MapView, Directions) {

      var map = new Map({
        basemap: "streets-navigation-vector"
      });

      var view = new MapView({
        container: "viewDiv",
        map: map,
        center: [-118.24532,34.05398],
        zoom: 12,
        padding: {
          right: 320
        }
      });
      
      // To allow access to the route service and prevent the user from signing in, do the Challenge step in the lab to set up a service proxy
      
      var directions = new Directions({
        view: view
      });
      
      view.ui.add(directions, "top-right");

    });
  </script>
</head>
<body>
  <div id="viewDiv"></div>
</body>
</html>



I'm still not familiar with JavaScript but thought it would be nice to try since there are html and css  that I can still learn from. Also, this only works in codepen.io

Highlighted codes are JavaScript codes




Popular posts from this blog

[CSS] Day 4: Let's practice - box

[AWS] Intro to Cloud Practitioner 01

[AWS] AWS Management Interfaces 02