Add a imageryLayer from ZXY tiles

hi all,
I have a folder of tiles with Z-X-Y levels. I want to add them to cesium map as an image layer.
I am using below code:

var customLayer = new Cesium.UrlTemplateImageryProvider({
url: ‘…/Content/sample/{z}/{x}/{y}.png’,
minimumLevel: 18,
maximumLevel: 21
});

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var imageryLayers = viewer.imageryLayers;
imageryLayers.addImageryProvider(customLayer );
viewer.flyTo(imageryLayers);

However, after I run website, nothing happen. I think that my code has something wrong.
Please help me. Thank you so much

Open the Developer tool and select the Network tab.
Then find your request and copy the requested URL.
Next, check if the URL is correct in the browser.

Thank you @ZhefengJin for your response. I got multiple errors such as:
“An error occurred in “TileMapServiceImageryProvider”: Failed to obtain image tile X: 144565 Y: 219238 Level: 19.”.
or
Cesium.js:1 GET https://localhost:44301/Content/sample/19/144565/305048.png 404

Is there any wrong in my code?

1 Like