2

I have a file with these information:

lat_min -60.0
lat_max 80.0
lon_min -180.0
lon_max 179.9
lon_sampling 0.1 degree
lat_sampling 0.1 degree
samples = 3600
lines   = 1401

I want to re-project the file to

I tried

 gdalwarp -of "ENVI" -t_srs `EPSG:3410`  -ts 1383 586 but give error
 gdalwarp -of "ENVI" -t_srs "+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +a=6371228 +b=6371228 +units=m +no_defs" -ts 1383 586 -ot Float32  file.envi file_1383586.envi 
ERROR 1: No PROJ.4 translation for source SRS, coordinate transformation initialization has failed
7
  • If you want to resample your image to a given number of pixels you are looking for the -ts option instead of -tr which refers to the size of a individual pixel. Your command should look like: gdalwarp -of "ENVI" -t_srs EPSG:3410` -ts 1383 586 input.envi output.envi` Depending on your data I suggest also taking a look at the possible resampling algorithms which can be invoked with -r
    – Kersten
    Commented Jun 11, 2015 at 11:11
  • Please provide more info on your error than 'but give wrong file'. What is wrong? Resolution, size, is there an Error message?
    – Kersten
    Commented Jun 11, 2015 at 11:12
  • @hyat you need to convert the input file into something that GDAL can understand. As is, that is where GDAL throws the error. Commented Jun 11, 2015 at 11:50
  • The copy.com link shows me "Sorry, you must be signed in to view this privately shared content."
    – user30184
    Commented Jun 11, 2015 at 12:20
  • GDAL could not find automatically the source srs, therefore it can't know how to do the conversion into your -t_srs. You must give also a correct -s_srs.
    – user30184
    Commented Jun 11, 2015 at 12:25

1 Answer 1

3

Since the files metadata is incomplete, you have to add it manually:

gdal_translate -a_srs epsg:4326 -a_ullr -180 80 179.9 -60 file.envi test.tif

and the result fits nicely to Natural Earth coastline, ready for further warping:

gdalwarp -of "ENVI" -t_srs "+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +a=6371228 +b=6371228 +units=m +no_defs" -ts 1383 586 -ot Float32  test.tif file_1383586.envi

enter image description here

4
  • -a:srs? you mean -a_srs. I had an error ERROR 4: .envi' not recognised as a supported file format.`
    – hyat
    Commented Jun 15, 2015 at 9:05
  • I loaded the tif into QGIS, and the Natural Earth shape as well. You are right, -a:srs was a typo. Did you get the Error 4 with gdal_translate or with gdalwarp? I had no problem with the latest GDAL from gisinternals.
    – AndreJ
    Commented Jun 15, 2015 at 9:29
  • gdal_translate may be I have to install the same version of gdal you used.What you think?
    – hyat
    Commented Jun 15, 2015 at 9:43
  • Surely. Format drivers may have been improved. GDAL 1.11.2 is the latest stable. On Linux and MacOS, available drivers may be different.
    – AndreJ
    Commented Jun 15, 2015 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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