Using Vector Tiles service with Esri API 3.18

36 views
Skip to first unread message

Carine Burri

unread,
Jul 19, 2021, 10:08:25 AM7/19/21
to GeoAdminCh API

Hello,

 

I have tried to the vector tiles service with ESRI javascript API 3.18 and get the error: Uncaught TypeError: Cannot read property '_getInfo' of undefined and then a timeout

 Error_getInfo.png

Here the code I used for the test :

<!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>VectorTileLayer sample</title>

  <link rel="stylesheet" href="https://js.arcgis.com/3.18/esri/css/esri.css">

  <style>

    html,

    body,

    #map {

      height: 100%;

      width: 100%;

      margin: 0;

      padding: 0;

    }

  </style>

  <script src="https://js.arcgis.com/3.18/"></script>

  <script>

    require([

      "esri/map",

      "esri/layers/VectorTileLayer",

      "dojo/domReady!"

    ], function(Map, VectorTileLayer) {

      var map = new Map("map", {

        center: [8.74497, 46.78260], // longitude, latitude

        zoom: 12

      });

             

              //The URL referenced in the constructor may point to a style url JSON (as in this sample)

      //or directly to a vector tile service

              var vtlayer = new VectorTileLayer("https://vectortiles.geo.admin.ch/styles/ch.swisstopo.leichte-basiskarte.vt/style.json");

      map.addLayer(vtlayer);

    });

  </script>

</head>

<body>

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

</body>

</html>

 

Do you know if it is compatbile with ESRI Javascript 3.18 ?

I have read the post https://groups.google.com/g/geoadmin-api/c/Y0vpYYkKNl4/m/QX2liAsdBAAJ and encounter the same issue as well using a different URL https://vectortiles.geo.admin.ch/styles/ch.swisstopo.leichte-basiskarte.vt/style.json.

Thanks for your feedback

Carine 

Reply all
Reply to author
Forward
0 new messages