WMTS - Failed to obtain image

Hi,

I’m very new to GIS. Please, bear with me.

I have been trying to add a WMTS layer to Cesium.

When i tried,

var viewer = new Cesium.Viewer(‘cesiumContainer’);
var provider = new Cesium.WebMapTileServiceImageryProvider({
url : ‘//maps.nlsc.gov.tw/S_Maps/wmts’,
layer : ‘EMAP8’,
style : ‘default’,
format : ‘image/jpeg’,
tileMatrixSetID : ‘GoogleMapsCompatible’,
proxy : new Cesium.DefaultProxy(’/proxy/’)
});
viewer.imageryLayers.addImageryProvider(provider);

It works fine. But,

var viewer = new Cesium.Viewer(‘cesiumContainer’);
var provider = new Cesium.WebMapTileServiceImageryProvider({
url : ‘//gis.sinica.edu.tw/tileserver/wmts’,
layer : ‘1956_Landuse’,
style : ‘default’,
format : ‘image/png’,
tileMatrixSetID : ‘GoogleMapsCompatible’,
proxy : new Cesium.DefaultProxy(’/proxy/’)
});
viewer.imageryLayers.addImageryProvider(provider);

and

var viewer = new Cesium.Viewer(‘cesiumContainer’);
var imageryLayers = viewer.imageryLayers;
imageryLayers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
url : ‘//maps.nlsc.gov.tw/S_Maps/wms’,
layers : ‘EMAP8’,
parameters : {
transparent : true,
format : ‘image/png’
},
proxy : new Cesium.DefaultProxy(’/proxy/’)
}));

throws error, ‘Failed to obtain image tile …’.
Why? Also, i was able to fetch the layers using another ‘GIS’ software.

Tried fixing it myself, but in vain. Anyone, who can help me out here please?

Thank you,
Monisha

Could any one help me with the second issue?

var viewer = new Cesium.Viewer(‘cesiumContainer’);
var imageryLayers = viewer.imageryLayers;
imageryLayers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
url : ‘//maps.nlsc.gov.tw/S_Maps/wms’,
layers : ‘EMAP8’,
parameters : {
transparent : true,
format : ‘image/png’
},
proxy : new Cesium.DefaultProxy(’/proxy/’)
}));

I tried passing parameters: version, service, request with no luck.

var viewer = new Cesium.Viewer(‘cesiumContainer’);
var provider = new Cesium.WebMapServiceImageryProvider({
url : '//maps.nlsc.gov.tw/S_Maps/wms?’,
layers : ‘EMAP2’,
parameters : {
VERSION : ‘1.1.1’,
service: ‘WMS’,
request:‘GetMap’,
transparent : ‘true’,
format : ‘image/png’
}
});
viewer.imageryLayers.addImageryProvider(provider);

-Monisha

Hi,

for your WMTS use, Cesium sends requests of that kind to the service :

http://gis.sinica.edu.tw/tileserver/wmts?service=WMTS&version=1.0.0&request=GetTile&tilematrix=4&layer=1956_Landuse&style=default&tilerow=4&tilecol=7&tilematrixset=GoogleMapsCompatible&format=image%2Fpng

and the response is a getcapabilities result, not an image. Can you compare with correct GetTile requests ?

Hi,

Thank you.

I was able to fetch the image using URL,

http://gis.sinica.edu.tw/tileserver/file-exists.php?img=1956_Landuse-png-{TileMatrix}-{TileCol}-{TileRow}

Now, the problem is with the second issue.

Monisha

Update:

‘//maps.nlsc.gov.tw/S_Maps/wms’ expects query string in CAPS (case sensitive). May seem weird, but,

http://maps.nlsc.gov.tw/S_Maps/wms?VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=EMAP8&STYLES=&FORMAT=image/png&SRS=EPSG:4326&BBOX=115.5,19.5,125.0,27.0&WIDTH=800&HEIGHT=800 - WORKS

http://maps.nlsc.gov.tw/S_Maps/wms?version=1.1.1&service=WMS&request=GetMap&layers=EMAP8&styles=&format=image/png&srs=EPSG:4326&bbox=115.5,19.5,125.0,27.0&width=800&height=800 - FAILS

Also, the server serves tiles only form level 4. So, if level is 3 or less, it throws error, ‘Failed to obtain image tile …’

  • Monisha