2

I just want to preface this by saying that I am not a cartographer, geographer or GIS professional, I just recognize that this is probably the best place to ask my question. As I am none of those things this is most likely a case of "I don't know what I don't know". Having said that, my general question is

How can I project satellite imagery onto DEM data?

My specific case is this. I have written some python to load SRTM 30m GeoTIFFs into Maya and use them to write out .obj (poly mesh) files. This works (as far as I am able to tell) exactly right. This gives me something I can use to visualize the area I am working with even though the OBJ file will be replaced by flat geometry with the GeoTIFF used as a height field at render time. It also lets me paint on the terrain so that the end result colorwise can be art directed. I am now currently working on a project where I need the resulting geometry to match the 'real world' color as closely as possible. I thought I would find some appropriate satellite imagery and project it onto my geometry that I have extracted from the DEM tiff. I have downloaded files from Sentinel-2 but I can't figure out how to align the Sentinel data to the DEM data. I'm sure that I'm not the first person to ever attempt this, I just can't figure out how to do it.

I am using n3[4,5]_w11[8,9]_1arc_v3.tif from USGS

and the .jp2 files in IMG_DATA from

S2B_MSIL1C_20210408T184159_N0300_R027_T11SLU_20210408T221014 and S2B_MSIL1C_20210408T184159_N0300_R027_T11SMU_20210408T221014 also from USGS

specifically the 2,3,4 bands for visible light

My understanding is that the Sentinel data is in UTM while the DEM is latlong and I can't figure out how to get them aligned. If I can get the Sentinel data aligned to the GeoTIFF, the sentinel data should easily map correctly onto the .obj created from the same GeoTIFF.

I have googled a lot but, again, I don't know what I don't know and I fear that I'm just searching for the wrong thing and/or just asking the wrong question. My hope is that there are python libraries that will help me? This

https://rasterio.readthedocs.io/en/latest/topics/reproject.html#reprojecting-a-geotiff-dataset

looks encouraging but I don't know enough about the subject to understand how it applies to my usage case.

3
  • Do you want python libraries so it can be part of an automated pipeline or will a command-line application do?
    – user2856
    Jun 9 at 3:35
  • I would love python libraries so that I understand how it works and the pipline doesn't have any black boxes in it, but I'm not projecting hundreds of images onto terabytes of DEM data so a command-line option is a great second. As long as it runs on Linux.
    – VFX Sup
    Jun 9 at 4:31
  • The python libraries are binary, so still "black box" to some degree though they're open source so you can peruse the c/c++. The command line gdal_warp program or the GDAL osgeo.gdal.Warp() python library method are based on the same underlying C++ library GDAL. rasterio is a higher level abstraction of GDAL (uses the same GDAL library under the hood). Normally I recommend rasterio over GDAL, but in this case it's easier to use gdal_warp or osgeo.gdal.Warp(). Have an attempt at using GDAL, it's in most major distros.
    – user2856
    Jun 9 at 5:47
1

I recommend using the GDAL Warp and/or Translate python functions. There are also fully-featured command line versions of these that are available through command line environments like OSGeo4W: https://gdal.org/programs/gdalwarp.html

Warp is meant to generate a derivative of your (georeferenced) raster in a different projection with different extents. Translate is for converting between file formats. IIRC, both tools can change things like resolution.

So, you must pick a projection to use as your basis for your 3D modeling and warp all of your datasets to that projection. If the data you're using isn't georeferenced (projection and extents are not defined), you will need to inform GDAL what it can assume for that. You might want to make the extents and resolution of your datasets match if you're trying to do something like vertex coloring.

Here's a large database of projections (spatial reference systems) that can usually just be referenced by their identifier: https://spatialreference.org/

1
  • rasterio may be an acceptable substitute for the gdal python library for this task. I don't personally have experience with that library though. Jun 9 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.