Select to view content in your preferred language

WebTileLayer can not show the map data in EPSG:3826 format

517
1
Jump to solution
12-28-2023 07:41 PM
AbramhumHsu
Emerging Contributor

Dear:

I meet a problem when using WebTileLayer show the map data in EPSG:3826 format. 

The code snippet is as following:

  const basemap = new Basemap({
                    baseLayers: [
                        new WebTileLayer({
                            urlTemplate: "https://wmts.nlsc.gov.tw/97/wmts/EMAP3826/default/default028mm/{level}/{row}/{col}",
                            title: "Basemap",
                            crossOrigin: 'anonymous',
                            extent: {
                                xmin: 128548.4443375419,
                                ymin: 2394066.4166165744,
                                xmax: 606875.5521,
                                ymax: 2919551.2968000006,
                                spatialReference: { wkid: 102443 }
                            },
                            spatialReference: { wkid: 102443 }
                        })
                    ],
                    title: "basemap",
                    id: "basemap",
                    spatialReference: { wkid: 102443 }
                });
 
and the error message shows:
WebTileLayer .... spatialReference must match tileInfo.spatialReference

 Is there any other methods can cover this problem? thanks a lot.

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

WebTileLayer's spatialReference is 102100. Looks like you are working with WMTS service (https://wmts.nlsc.gov.tw/97/wmts/). So I would add the layer as WMTSLayer as shown below. 

 

const layer = new WMTSLayer({
  url: "https://wmts.nlsc.gov.tw/97/wmts"
  extent: {
    xmin: 128548.4443375419,
    ymin: 2394066.4166165744,
    xmax: 606875.5521,
    ymax: 2919551.2968000006,
    spatialReference: { wkid: 3826 }
  }
});

const map = new Map({
  layers: [layer]
});

const view = new MapView({
  container: "viewDiv",
  map: map,
  spatialReference: { wkid: 3826 },
});

 

View solution in original post

1 Reply
UndralBatsukh
Esri Regular Contributor

WebTileLayer's spatialReference is 102100. Looks like you are working with WMTS service (https://wmts.nlsc.gov.tw/97/wmts/). So I would add the layer as WMTSLayer as shown below. 

 

const layer = new WMTSLayer({
  url: "https://wmts.nlsc.gov.tw/97/wmts"
  extent: {
    xmin: 128548.4443375419,
    ymin: 2394066.4166165744,
    xmax: 606875.5521,
    ymax: 2919551.2968000006,
    spatialReference: { wkid: 3826 }
  }
});

const map = new Map({
  layers: [layer]
});

const view = new MapView({
  container: "viewDiv",
  map: map,
  spatialReference: { wkid: 3826 },
});