WebMapServiceImageryProvider with WebMercator 102100

Hi alL,

I am new to Cesium. Currently I am working on showing an Web Mapping Service hosted on ArcGIS Server 10.1 on the Cesium globe.

The web mapping service only supports WebMercator 102100. When it was added to Cesium through "WebMapServiceImageryProvider", nothing was shown but blue images. Cesium interprets it to projection 4326 automatically as it can be observed from Firebug.

Just wonder if there is a support for WebMercator in "WebMapServiceImageryProvider". Is it projection configurable in Cesium?

Thanks a lot!

Cheers,
Alex

Hi Alex,

I’m surprised to hear that your ArcGIS WMS service only supports 102100. Usually ArcGIS can reproject on the fly. Also, you might try using ArcGisMapServerImageryProvider instead of the WMS provider.

To answer your actual question, though, Cesium itself supports WebMercator imagery, it’s only the WMS imagery provider that does not. Fortunately, it’s easy to work around by editing the code. Change this line:

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/WebMapServiceImageryProvider.js#L96

to construct a WebMercatorTilingScheme instance instead of the GeographicTilingScheme. Don’t forgot the update the list of requires at the top of the file. If you’re not using a global extent for the provider, you’ll need to convert them to WebMercator units (WebMercatorProjection.project can help with this) and pass extentSouthwestInMeters and extentNortheastInMeters parameters to the constructor instead of the extent parameter. Then, change this line to specify the new SRS in the URL:

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/WebMapServiceImageryProvider.js#L134

If you haven’t built Cesium yourself before, it’s not hard. Follow the instructions in the Contributor’s Guide;

https://github.com/AnalyticalGraphicsInc/cesium/wiki/Contributor%27s-Guide

I hope this helps!

Kevin

Hi Kevin,

Appreciate your prompt reply.

I took the easier path to use ArcGisMapServerImageryProvider, but it still failed. My map service only covers the Victoria state of Australia, and the ArcGIS Server only works within our organization's internal network. Does Cesium require the map service to be accessible?

Thanks.

Cheers,
Alex

Hi Alex,

No, ArcGisMapServerImageryProvider doesn’t require the server to be publicly available on the internet. It does need to either include a CORS header, or the request must be sent through a proxy. I believe ArcGIS Server 10.1 has support for CORS, but I don’t know offhand how to activate it. See http://enable-cors.org/ if you’re not familiar with CORS.

You can also use the proxy server that’s included with Cesium on GitHub (it’s not included in the distribution ZIP files). Edit build.xml in the root directory to add your server to the list of allowed hosts for proxying, and then specify the proxy when you construct the ArcGisMapServerImageryProvider: Something like:

var provider = new ArcGisMapServerImagerProvider({

url : ‘…’,

proxy : new DefaultProxy(’/proxy’)

});

Kevin

Thanks Kevin. Are you able to provide a download link to the proxy server on GitHub that I was unable to?

Alex,

There’s no direct download link. The Contributor’s Guide has instructions for pulling from GitHub, though, as well as instructions for running the server.

Kevin