Display Vector Tiles service with Esri JavaScript API

Skip to first unread message
Assigned to gilbert....@gmail.com by david...@gmail.com

Alexandre Gauch

Jun 15, 2021, 3:51:51 AM6/15/21
to GeoAdminCh API

I try to display the geo.admin.ch vector tile service with the Esri JavaScript API (4.19) but I get an error: "Unsupported vector tile raster layer".

Here is the sample code that I use:

    <meta charset="utf-8" />
    <title>VectorTileLayer | Sample | ArcGIS API for JavaScript 4.19</title>
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;

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

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

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

        var tileLayer = new VectorTileLayer({
    <div id="viewDiv"></div>

If I use a sample vector tile service from Esri (the commented url), it works fine.

Does anybody already used the Esri JavaScript API to display a geo.admin.ch vector tile service? Or do you have an idea of the problem?

Thanks for your help.

GeoAdminCh API

Jun 16, 2021, 4:33:37 AM6/16/21
to GeoAdminCh API

Maptiler did as part of thier research in the past a compatibility test.

The PBF MVTs were binary compatible. But JSON metadata and style syntax was slightly different.

Maptiler.ch had MapTiler Basic services (which are the same as we have )  running in ArcGIS Online as well as ArcGIS Pro and API. Check their old tweets.

Entire ESRI VT stack is in fact a modified fork of MapBox GL AFAIK

We will look into that... but we can't promise anything

Carine Burri

Jul 19, 2021, 10:09:32 AM7/19/21
to GeoAdminCh API



When you say :  "The PBF MVTs were binary compatible. But JSON metadata and style syntax was slightly different." Could you tell us between which tiles there is a difference?

Thanks for your help,



Nicola Pfister

Jan 14, 2022, 5:51:32 AM (4 days ago) Jan 14
to GeoAdminCh API
Our current project of the ASTRA is running into the same issue, trying to load the "Light Base Map" using the latest ArcGIS JS API. If I understand the issue correctly, it should be possible to take the Swisstopo Style JSON and change the format, so that it can be loaded. Could you provide more details as to how to achieve this. At the moment I'm struggling to figure out where exactly the differences are.


Jan 14, 2022, 7:39:51 AM (4 days ago) Jan 14
to geoadm...@googlegroups.com

if it’s only a problem with raster vector-tiles:


remove raster VTs in the style (or via JS) and load alternative background. the swiss relief exists as WMTS:



the worldwide relief is only available as raster Vectortiles via maptiler and you would have to ask maptiler.com if this is available in other formats.

You received this message because you are subscribed to the Google Groups "GeoAdminCh API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geoadmin-api...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geoadmin-api/b2b13ae2-4be6-4040-9524-da14825f9f68n%40googlegroups.com.

Nicola Pfister

Jan 17, 2022, 6:29:42 AM (yesterday) Jan 17
to GeoAdminCh API
Thank you, I was actually able to render the map in ArcGIS JS by removing the relief layer. I've created a minimal reproduction in codesandbox if anybody else is interested.

That brings me to two new questions:
  • The labels for mountain peaks seem to not be working. It's displaying what I assume to be a format string instead, maybe due to the height numbers. Do you have any idea why that might be? In the worst case, I could probably disable those labels by removing the layer from the styles.json, correct?Swisstopo_LBM_arcGIS_JS_mountain_peaks_issue.jpg
  • Does the Mapbox vector tiles service support WGS84 only? Our application is supposed to offer it's data mainly in LV95 which is why we chose it as the base coordinate system and are using WMTS services in LV95 as well. Depending on your feedback we might have to investigate into trying to do some transformation or switching to WGS84 altogether.
Thanks in advance for your feedback!

GeoAdminCh API

Jan 17, 2022, 12:17:33 PM (yesterday) Jan 17
to GeoAdminCh API
"Does the Mapbox vector tiles service support WGS84 only? "
-> The MVT Service Standard does support Webmercator only -- we follow this standard. However there are workarounds https://www.arcgis.com/home/item.html?id=02a87fcb632449099bf53f904fd309b9 and https://labs.klokantech.com/swissvt/ and the corresponding source https://cloud.maptiler.com/tiles/v3-2056/ 

For the first question : we will look for the answer internally

Sebastian Denier

6:06 AM (10 hours ago) 6:06 AM
to GeoAdminCh API
Regarding "The labels for mountain peaks seem to not be working"
-> it doesn't seem to be able to interpret the [format] expression used in the style.json for the peaks (it is used to label the name of the mountain peak bigger than the eleveation of the peak).
You can change the style.json and replace the "text-field" parameter with the following (mountain peak and elevation will be the same size however):

    "text-field": [
      ["get", "name:latin"],
      ["get", "ele"]
for ("peaks_other", "peaks_rank3+", "peaks_rank2", "peaks_rank1")

but a smarter way than editing the style would be to do it with JS: override the text-field paramter for all peaks layers (in that way you do not have to worry about editing new style files in future updates).
see code:
Reply all
Reply to author
0 new messages