Creating polygons that follow the curvature of the Earth in ArcGIS JS

3darcgis-10.2arcgis-maps-sdk-javascriptpolygonpolygon-creation

I am trying to divide a globe into equally sized squares and render them using ArcGIS JS where the rendered polygons follow the curvature of the earth.

So far, I've made an algorithm to divide a sphere into equally sized rectangles. On a 2D format that looks like this:equally sized rectangles

When projected onto a sphere, this perfectly divides the Earth into squares (or square-like shapes close to the poles). I've created a GeoJSON layer from the corner coordinates of the squares and rendered them as Polygons in ArcGIS JS.

The problem is that the lines between points do not follow the curvature of the Earth, and although this is not an issue around the Equator, the distortion around the poles is massive.

Squares close to the Equator (no noticeable distortion):
Squares around the equator

Squares close to the pole (very big distortions):
Squares around the poles

Is there any built-in feature to ArcGIS to deal with this? Or do I have to find another method of determining the different points in the polygon to get a close abstraction?

Best Answer

Turns out applying a z-index to all the coordinates were the problem. If you let all the polygon ring coordinates consist of (x,y) and not (x,y,z), the geometry will follow the curvature of the earth as expected, although this seems to come at a significant performance cost. (The view is now laggy due to the large FeatureLayer).