I'm trying to reproject Mapbox maps from whatever projection they come in (which I believe is EPSG:3857) to what I believe should be a Gnomonic projection.
Let me try to be more clear actually. I'd like to use the map tiles to generate UV faces for a cube like this one:
The image below uses an equirectangular environment texture as the diffuse shader for the cube, and baking a single face of the cube would result in an image like this one:
What I'm trying to do is get a similar "cube face" texture, but without using Blender to shade and bake the texture. Instead I'm trying to use GDAL to reproject the texture to what I believe should be a Gnomonic projection, with radius equal to half the diagonal of a cube face, and the centre of projection being the coordinates that map to the centre of the cube face. So for the North Pole, that would be 90°N 0°E, and for the front face that would just be 0°N 0°E.
So to get the face that would contain the British isles, I thought these GDAL commands should suffice:
gdal_translate -a_srs EPSG:3857 -a_ullr -20026376.39 20048966.10 20026376.39 -20048966.10
gdalwarp -t_srs +proj=gnom
But if I do that, I instead get a very high image with narrow width, that seems to contain mostly just ocean.
The question is, what would be the right projection string to get a cube-face like the picture above?
Note that I've been using gdal-js
to do the transformations in the browser. See this CodePen for example, which contains an example that converts the source image to equirectangular projection. The projection string can be edited in the JS editor and the result is updated real-time (this is what I used to experiment with projections.)
UPDATE:
I think I'm doing something wrong with the reprojection. The following commands give me the wonky looking result below:
gdal_translate -a_srs EPSG:3857 -a_ullr -20026376.39 20048966.10 20026376.39 -20048966.10
gdalwarp -t_srs +proj=ortho
I'm pretty sure that transparent band around the equator should not be there. Instead, there should be a transparent bit around the poles, since web mercator does not cover the last 5°s or so.