# Blender: Project a map on a sphere

I have a portion of a map, with its coordinates, and I want to project it in its correct position on a sphere, like on a planet. This map is a geotiff image with its geographic coordinates.

I traid to insert it as an image texture into the sphere, and then adjust the map position on the sphere manually, but that solution is imprecise. Plus, I would like to add several maps on the same sphere, and I need to manteind the correct position of them.

Is there any way to put the map in its correct coordinates with blender?

This is one of the images (from Mars), as an example:

And this is what I need:

• Hello :). Please add na image to illustrate what kind of map you have. – Jachym Michal Oct 9 at 13:48
• Recommend the blenderGIS addon. – batFINGER Oct 9 at 13:58
• – brockmann Oct 9 at 14:32
• how is it supposed to be projected on the sphere? – moonboots Oct 9 at 14:58
• Started an answer based on combining blender.stackexchange.com/questions/159483/… and overlaying the map image based on its corner coords mapped to its portion of the equirectangular UV (latidude x longitude). However nodes isn't my strong suite. Could post the theory and links to setup without final node setup? – batFINGER Oct 9 at 16:43

Considering the map part corresponds to an equirectangular projection, we can do a plane to sphere deformation by the approach indicated here.

Making a sphere from a grid

The base grid should be in the proportions of width/height = 2 as we map as longitude is 360 degrees and longitude is 180 degrees.

If the grid is parallel to the front view, we can give it some flat subdivisions and bend it 180° around X and 360° around Z.

To unwrap it (as we'll use UV mapping), still in front view and edit mode use U then "Project from view (bounds)".

The shader to place the map part

From the given image, we can see that the map part is (approximatively) from -160° to -126° in longitude and from 28° to 64° in latitude.

What we have to do:

• Determinate if a given point is inside the map part
• Remap this map part at the position given by its coordinates ranges

In X (or U) in the UV map, a given coordinate is between 0 and 1. The longitude is between -180 and 180. So we can shift the map part coordinate by 180 and divide it by 360 to go from the longitude space to the UV space.

Same thing from Y (or V).

With this calculation (done by AddDivide node group in the blend below) applyed to the map part coordinates, we can test if a given UV map point is inside the map (done by Between node group in the file below).

This first calculation indicates if the texture has to be drawn on the sphere for a given UV map point.

Now to draw the texture at the wanted location, we need to remap the UV point to the texture space in the good location and proportion.

This is done by substracting the min map coordinate in UV space with UV point coordinate then divide that by the map range in UV space.

X in texture space = (X in UV space - min map X in UV space) / (max map X - min map X in UV space)


This part is done by Remap01 node group in the file.

Last, we combine all together in a single node group so that you can apply it to several map parts.

This node group is called RemapEquirectangular and has the following parameters: the UV coordinates, min and max longitude, min and max latitude.

The result is the following:

• Thankyou can't wait to test it out. eg astrogeology.usgs.gov/search/map/Mars/Mars2020/… has the geospatial data (looks like OP has used his phone for that image) – batFINGER Oct 16 at 8:29
• @batFINGER, don't know what to download in this link? Tried some tif but no coordinates on it. Other thing: you mentioned a file that crashes you computer previously. Do you want me to have a look? – lemon Oct 16 at 8:53
• Just grab the image... astropedia.astrogeology.usgs.gov/download/Mars/Mars2020/… Here is what I'm using for low res global EP attic.gsfc.nasa.gov/mola/images/shade_med.jpg Scroll down to where it details the geospatial info Feature Name Jezero crater Minimum Latitude 18.211 – batFINGER Oct 16 at 9:01
• @batFINGER, ah... ok. Get it. – lemon Oct 16 at 9:07
• (the tiff is a geotiff has geospatial data in meta and is a grid of elevation values blenderGIS deals with this well) or to play around with check out GDAL tools – batFINGER Oct 16 at 9:07