Fail to add arcgis map service using UrlTemplateImageryProvider

1. A concise explanation of the problem you’re experiencing.

I try to use UrlTemplateImageryProvider to load a map service with custom projection hosted by ArcGIS Server. And I met CORS problem.

The service is not hosted in my local device. But I can load the map service by using ArcGIS JavaScript API and Openlayers in my localhost.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

var viewer = new Cesium.Viewer(‘cesiumContainer’, {


var imageryLayers = viewer.imageryLayers;

imageryLayers.addImageryProvider(new Cesium.UrlTemplateImageryProvider({

url : ‘http://remote IP address:8080/rest/services/shmap/MapServer/tile/{newz}/{newy}/{newx}’,

customTags : {

newz: function(imageryProvider, x, y, level) {

return level-9;


newy: function(imageryProvider, x, y, level) {

return y-165* (1 << (level-9));


newx: function(imageryProvider, x, y, level) {

return x-855* (1 << (level-9));



tilingScheme:new Cesium.GeographicTilingScheme()



3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I want to figure out it is a client side (Cesium) problem or a server side problem (ArcGIS Server).

4. The Cesium version you’re using, your operating system and browser.

Cesium 1.46.1

Windows 10

Chrome 67.0.3396.99

Here is the error in console:

CORS must be enabled on the server side. For more details: