How to tile Mars themis raster for Cesium

I am trying to tile the Mars themis raster that has the following crs:

PROJCS["SimpleCylindrical Mars",

The --profile option in gdal2tiles can be geodetic, mercator or raster. Given the projection of the input raster above, I tile the raster as follows: --zoom=0-7 --profile raster input.tif output/

However, Cesium.js is unable to consume these tiles because it only supports a tiling scheme of either geodetic or mercator.

Is there a workaround? I was wondering if someone could kindly point me in the right direction.

Normally the easiest way is to just upload your imagery to Cesium ion ( which will handle reprojecting and tiling. In this case it looks like the Mars spatial reference isn’t supported at the moment, I get:

Error: Invalid spatial reference system
File: Mars.tif
Spatial Reference System: PROJCS["SimpleCylindrical Mars",GEOGCS["GCS_Mars",DATUM["D_Mars",SPHEROID["Mars",3396190,0]],PRIMEM["Reference_Meridian",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]]],PROJECTION["Equirectangular"],PARAMETER["standard_parallel_1",0],PARAMETER["central_meridian",180],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH]]

So you may need to reproject it to something else.

What happens when you pass --profile mercator ?

An example that may be helpful to look at is this Sandcastle showing lunar terrain and imagery. This is from this forum discussion: Clamping To Terrain on Lunar globe. It looks like the WMS imagery of the lunar surface in this example is served as EPSG:4326.

Hi Omar,

Thank you so much for getting back to me. We wish to utilize the Ion offering further down the road once we have a working prototype.

I have now projected the original raster to EPSG4326 and applied --profile mercator while tiling. Based on your suggestions, I now instantiate the Cesium.Viewer as follows:

var ellipsoid = new Cesium.Ellipsoid(3396190,3396190,3396190);

Cesium.Ellipsoid.WGS84 = ellipsoid;
var mapProjection = new Cesium.GeographicProjection(ellipsoid);

var globe = new Cesium.Globe(ellipsoid);
globe.showGroundAtmosphere = false; // necessary for tiles to show in non-earth ellipsoid
globe.depthTestAgainstTerrain = true;

var opts = {
    mapProjection: mapProjection,
    globe: globe,
    skyAtmosphere: false,
    imageryProvider: new Cesium.createTileMapServiceImageryProvider({
       url : 'http://localhost:8080/epsg4326',
       fileExtension : 'png',
       ellipsoid: ellipsoid

Cesium now recognizes the tiles, however, there are holes at the poles, which is not unexpected. Is there a way to extend the coverage further toward the poles? I also see a blue streak – likely at 0 longitude – that I am not too sure how to get rid of.
Any tips to resolve these issues would be fantastic and thank you so much again for your help.


Yeah the gaps are occurring because of the mercator projection. I think what you’d want instead is actually the --profile geodetic. As far as I understand, this will use a Earth-specific projection, but this may be “close enough”, and the geographic projection should cover the entire globe with no gaps.

I’ve tried --profile geodetic but no luck – in fact, gdal2tiles keels over for some reason midway through the tile generation process and needs to be relaunched in resume mode to complete the tile generation. However, Ceseium then fails to consume those tiles. It’s not clear to me whether the problem is with the output from gdal2tiles or Cesium.
I’ve seen others use tiles in mercator projection in Cesium without the sliver artefact – could there be any other tweaks I am missing?
Thank you so much again.

Have you tried loading this in any other viewer to narrow this down? Maybe QGIS or OpenLayers etc.

I haven’t seen this sliver artifact before in CesiumJS, and I would guess it’s coming from the imagery tiles themselves, but you should be able to confirm that.