3

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: enter image description here

And this is what I need:

enter image description here

Inaki
  • 33
  • 5
  • 1
    Hello :). Please add na image to illustrate what kind of map you have. – jachym michal Oct 09 '20 at 13:48
  • Recommend the blenderGIS addon. – batFINGER Oct 09 '20 at 13:58
  • related: https://blender.stackexchange.com/questions/3315/how-to-get-perfect-uv-sphere-mercator-projection – brockmann Oct 09 '20 at 14:32
  • how is it supposed to be projected on the sphere? – moonboots Oct 09 '20 at 14:58
  • 1
    Started an answer based on combining https://blender.stackexchange.com/questions/159483/how-can-i-rotate-a-spherical-texture-without-getting-a-distortion/159492#159492 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 09 '20 at 16:43
  • Hi Inaki. what is the mapping (projection) of this map part? (@batFINGER) – lemon Oct 15 '20 at 17:15
  • For now would simply assume know the corner coords in lat long. The 2x1 grid is long x lat. The map in question appears grid aligned. – batFINGER Oct 15 '20 at 17:22
  • @batFINGER, so it is flat projection? But could also be equirectangular...? The link you provided (simple deforms) could do if we know how to place it on the UV map. – lemon Oct 15 '20 at 17:24
  • To make as a mesh could add one corner, spin to the next etc. If the map above is 10 degrees by 10 degrees could make a grid 36x18 where the appropriate face would designate the map.. If we put the map on the equator where the tissot index is 1:1 can use a mapping node to transform such that it is a square on surface over pole. Not sure how to do this with nodes. One of those things that looks easy then does my head in. Thanks for looking into it. The OP doesn't seem that interested. Have a number of map projections put together. Being able to do this via nodes would be a handy addition. – batFINGER Oct 15 '20 at 17:48
  • As I see it, doing it with nodes is simply following the UV map. If no UV map, probably have to convert coordinates to polar co, using arctan2 (won't have time to check that today...) – lemon Oct 15 '20 at 18:06
  • @batFINGER, FYI, have tried an answer. Don't know if it is what you expected? – lemon Oct 16 '20 at 07:32

1 Answers1

4

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)".

enter image description here

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.

enter image description here

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:

enter image description here

lemon
  • 60,295
  • 3
  • 66
  • 136
  • Thankyou can't wait to test it out. eg https://astrogeology.usgs.gov/search/map/Mars/Mars2020/JEZ_ctx_B_soc_008_orthoMosaic_6m_Eqc_latTs0_lon0 has the geospatial data (looks like OP has used his phone for that image) – batFINGER Oct 16 '20 at 08: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 '20 at 08:53
  • Just grab the image... https://astropedia.astrogeology.usgs.gov/download/Mars/Mars2020/thumbnails/JEZ_ctx_B_soc_008_orthoMosaic_6m_Eqc_latTs0_lon0_1024.jpg Here is what I'm using for low res global EP https://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 '20 at 09:01
  • @batFINGER, ah... ok. Get it. – lemon Oct 16 '20 at 09: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 '20 at 09:07
  • @batFINGER the detail image is very very small...around 0.5°... Do you have a link to a hires global map? – lemon Oct 16 '20 at 09:15
  • With mars images packed in it. The detailed part is at the spherical empty location: – lemon Oct 16 '20 at 09:30
  • cool! That's what I need! Thank you! – Inaki Oct 16 '20 at 12:00