Having trouble implementing Polar Stereographic Projection for Imagery Provider

We are now working on using CesiumJS to support a research project planning to send a rover to a polar region of the moon. We have a bunch of data, map tiles, that we have been rendering in OpenLayers, and I am porting that over to render in CesiumJS.

Per the newsgroups and my research, there is not currently a polar projection, but since I already have the code written for OpenLayers I have ported that over to CesiumJS.

Unfortunately it is not behaving as expected. The image renders as a curved swath, instead of filling the bounds of the rectangle.

What I have done is created a MapProjection which implements the conversions I need to go to/from either north or south polar stereographic projection. I have then created a TilingScheme which extends the WebMercatorTilingScheme, but sets the projection to be the polar projection I am interested in. In the constructor of my TilingScheme, I do this:

// the base class used the web mercator projection to figure out the rectangle. Redo that work.
        this._projection = options.projection;
        let southwest = this._projection.unproject(options.rectangleSouthwestInMeters);
        let northeast = this._projection.unproject(options.rectangleNortheastInMeters);
        this._rectangle = new Cesium.Rectangle(southwest.longitude, southwest.latitude,
            northeast.longitude, northeast.latitude);
        console.log('projection rectangle in radians');
        console.log(this._rectangle);

I have a hunch that the problem lies in determining what is a 'hit' in the imagery provider, that is when going from geodetic coordinates to the native rectangle it is not correct. I can correctly render a bounding rectangle defined in lat/long coordinates via kml.

Any nudges in the right direction will be greatly appreciated. Once I get this working I can also contribute it back to Cesium codebase.

thanks
Tamar

OSX, Chrome, Cesium 1.40.0

Image is here:
https://pbs.twimg.com/media/DTOvyDgVoAAnI5A.jpg:large

I have verified converting to and from my projection, and I have verified that the functions in my TilingScheme behave as expected. I am wondering if there are any inherent assumptions about the globe that the imagery layer's tiles have to match the globe's geometry or something? I was thinking I could do an experiment where I created a rectangle geometry and put this imagery layer on it, but only the globe supports the imagery layer.

Hi Tamar,

I believe the issue may stem from how we “fill in” imagery data around the poles with a shader. Here’s a relevant forum thread. The Web Mercator projection does cut off at a certain latitude near the poles. Is that all the modified code? It might help to see the rest.

I know there are others interested in using imagery around the poles, so a contribution would be greatly appreciated!

Thanks,

Gabby

Hi Gabby,

Can you point me to your code where you render the imagery on the globe? I was looking at _createTileImagerySkeletons method in ImageryLayer.

My issue is different from the one about missing tiles at the poles – first of all, I am using a base layer from ASU and there is data at the poles – it renders ok for a base layer especially once the user has zoomed in. My issue is that I have my own imagery layer, it’s in a polar stereographic projection, and it’s not rendering to fully fill its bounding rectangle, instead it is smeared out in an arc (which actually cuts outside its rectangle in one area).

Would there be any way for me to assign an imagerylayer to my own geometry?

thanks so much

Tamar

_createTileImagerySkeletons defines the extents of the imagery and where it is on the globe, but it does not actually render the imagery. _createTexture creates the texture from the image that will then be sent to the GPU to render, and _reprojectTexture also may be of interest in this case.

You can also apply an image to a geometry by setting it’s material, like in this example.

I’m not very knowledgeable on imagery projections, so I’m sorry I can’t be of more help in that regard. Perhaps another community member might know more and be able to chime in?

Thanks,

Gabby

Thanks Gabby – those pointers are helpful, I will take a look at that code.

Hi All,

I'm still working this issue and I'm coming back to the geometry of the globe. Here is what I think, and why:

The documentation in here:
https://cesiumjs.org/Cesium/Build/Documentation/UrlTemplateImageryProvider.html
includes tiling scheme, specifying how the ellipsoidal surface is broken into tiles.

Therefore I have created my own EllipsoidTerrainProvider using my polar stereographic tiling scheme:
viewerOptions['terrainProvider'] = new Cesium.EllipsoidTerrainProvider({tilingScheme: tilingScheme});

When I run the code with this tiling scheme, I see a gray-colored globe missing the ends.

I'm also getting the following stack trace:
CesiumWidget.js?5b05:657 An error occurred while rendering. Rendering has stopped.
undefined
DeveloperError: Rectangle height must be between 0 and pi
Error
    at new DeveloperError (webpack-internal:///1:43:19)
    at Function.OrientedBoundingBox.fromRectangle (webpack-internal:///107:279:19)
    at new TileBoundingRegion (webpack-internal:///206:126:57)
    at createTileBoundingRegion (webpack-internal:///755:247:16)
    at Function.GlobeSurfaceTile.processStateMachine (webpack-internal:///755:267:46)
    at GlobeSurfaceTileProvider.loadTile (webpack-internal:///754:473:26)
    at processSinglePriorityLoadQueue (webpack-internal:///763:743:26)
    at processTileLoadQueue (webpack-internal:///763:734:9)
    at QuadtreePrimitive.endFrame (webpack-internal:///763:324:9)
    at Globe.endFrame (webpack-internal:///749:612:27)

I'm thinking that I might have to build a hybrid tiling scheme to handle the northern hemisphere in north pole projection and the southern hemisphere in south pole projection since we are building the entire globe. Are there any other suggestions as to what might be causing this error? Is there something else I should be doing in my Ellipsoid Terrain Provider? I get no indication that my map projection code is even being called.

Thanks
Tamar

Hi Tamar,

Curious if you were ever able to figure out a good approach to loading in polar imagery?

  • Victor