Geoaccelerators JSAPI GCS

by Bryan McIntosh

HTML

<html>

  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
    <!--
     ArcGIS API for JavaScript, https://js.arcgis.com
     For more information about the layers-vectortilelayer sample,
     read the original sample description at developers.arcgis.com.
     https://developers.arcgis.com/javascript/latest/sample-code/layers-vectortilelayer/index.html
     -->
    <title>Geoaccelerators ESRI JavaScript API VectorTileLayer</title>
    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
      }

    </style>

    <link rel="stylesheet" href="https://js.arcgis.com/4.14/esri/themes/light/main.css" />
    <script src="https://js.arcgis.com/4.14/"></script>

    <script src="index.js">
    </script>
  </head>

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

</html>

JavaScript

require([
  "esri/Map",
  "esri/views/MapView",
  "esri/layers/VectorTileLayer"
], function(Map, MapView, VectorTileLayer) {
  // Create a Map
  const map = new Map();

  // Make map view and bind it to the map
  const view = new MapView({
    container: "viewDiv",
    map: map,
    //center: [-84.55, 39.2],
    zoom: 9
  });

  /********************************************************************
   * Add a vector tile layer to the map
   *
   * The url must point to the style or the vector tile service
   *********************************************************************/

  const contours = new VectorTileLayer({
    url: "http://localhost:8000/VectorTileServer/"
  });
  map.add(contours);
});