2

I am trying to georeference a tif image with the QGIS GUI, and then I load and save the Gdal script. With the QGIS GUI, I managed to get a decent picture, then I exports it in Geotif.

I would like to use the gdal executable store in the qgis file (bin file) for the same operation. So, I try to do the same operation with a DOS command with gdal_translate and gdalwarp. But it doesn't work. The operation with the DOS command gives me a black image. With the same gdal script, under QGIS, the image is correct. I only make a copy paste under the DOS command. The first part, the gdal_translate seems to work, and I think it is the gdalwarp the problem.

These are my command lines :

gdal_translate -of GTiff -gcp 18.4111 34.3009 *(... a lot of GCP ...)* "S:/image/geotiff/TrueMarble.tif" "C:/Users/userme/AppData/Local/Temp/TrueMarble.tif"
gdalwarp -r cubicspline -order 3 -co COMPRESS=NONE -dstalpha "C:/Users/userme/AppData/Local/Temp/TrueMarble.tif"
 "S:/image/geotiff/Poly3"
1

Usually I specify -s_srs and -t_srs (source and destination projection system) you can either reference a proj4 name or provide the path to a .prf file, or specify manually your projection parameters.

I suspect this might be the cause of your problem since it doesn't seem you ever defined the reference system of your gcp. The GUI might be doing this for you on the fly.

Also you didn't specify the output resolution with -tr, and while you are at it you could also specify the data type with -ot

  • How can I know the output resolution of the image ? – Manimalis Jul 8 '15 at 8:33
  • It depends, it could be the same as input if you know it. Otherwise you can just decide it and it will use the -r "cubicspline" argument you provided to interpolate value at the resolution you want. There must be a theorical resolution to your dataset. Or maybe you want to resample it at a coarser resolution? – STLeclerc Jul 8 '15 at 13:16
1

When I was doing some cropping with gdalwarp, my mask was making the area that I wanted dropped all black. A co-worker advised that the direction of the coordinates could be the issue. Apparently drawing coordinates in one direction (Clockwise for example) will keep everything outside the crop area and the other way (counter clockwise) will keep everything inside of the drop area. When I changed the direction of my cutline coordinates, it did what was expected.

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.