1

SRTM data is given in Lat/Lon coordinates, while Landsat is given in UTM coordinates. Is there a way to reproject the SRTM data into the Landsat CRS in GDAL (Python)?

fmonegaglia
  • 211
  • 2
  • 7
  • Yes. For example with gdalwarp http://www.gdal.org/gdalwarp.html which is also pythonized https://trac.osgeo.org/gdal/wiki/rfc59.1_utilities_as_a_library. – user30184 May 03 '17 at 05:44
  • I have python's gdal installed but it seems that there is no function gdal.Warp().. – fmonegaglia May 03 '17 at 07:30
  • I am not sure which GDAL version has the support. Trunk an least does and this autotest script may be useful for you https://svn.osgeo.org/gdal/trunk/autotest/utilities/test_gdalwarp_lib.py. – user30184 May 03 '17 at 08:28

1 Answers1

2

The tool in gdal that can reproject your data is gdalwarp.

With gdalwarp, you must provide the source and target coordinate systems with -s_srs and -t_srs, respectively. In your case, it would be

gdalwarp -s_srs EPSG:4326 -t_srs EPSG 326xx your_source _file_name your_dest_file_name, where xx are the numbers of the UTM zone.

Note that you can get the coordinate system automatically if your have images everywhere in the world (see, e.g., GDAL/Python: How do I get coordinate system name from SpatialReference?)

radouxju
  • 49,636
  • 2
  • 71
  • 144
  • The code reported in the link you provided does not work in my case (it seems that srs.IsProjected() is returning False). Is there any way to automate this within a Python script? – fmonegaglia May 03 '17 at 07:38