Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have an input jpg image (sat thumbnail) and I know a number of gcps for this image. I want to reproject the jpg to have a north up image. This is what I do:

./gdal_translate -of GTiff -a_srs EPSG:4326 -gcp pixel line lon lat -gcp pixel line lon lat ... etc... myinputfile.jpg temp.gtif

./gdalwarp -t_srs EPSG:4326 -r near temp.gtif myoutputfile.tif

The result is "almost" correct, although I do get some strangest behaviours sometime, eg the image folds on itself, etc... very artistic but not good for a GIS application! If anybody can see anything wrong with the way I proceed or has a better idea, please advise!

Edit

Alright, it is working now. I believe the "weird" results were down to the fact I used a temporary file that was not deleted between gdal calls. As soon as I had the temp file removed (rm temp.gtif) between calls the results were fully normal.

share|improve this question
    
at what stage does this occur? gdal_translate or gdalwarp? –  Matthew Snape Jun 7 '11 at 17:00
    
Well, I only use translate to add the gcps and convert to gtif as far as I understand. The strange results are for when I visualise the final (warped) tiff. I tried gdalinfo on the "translated" gtif and it all looked fine to me. –  Thomas Jun 7 '11 at 17:50
    
Alright, it is working now. I believe the "weird" results were down to the fact I used a temporary file that was not deleted between gdal calls. As soon as I had the temp file removed (rm temp.gtif) between calls the result were fully normal. –  Thomas Jun 13 '11 at 8:22
1  
The behaviour you found is intentional and documented, but it is easy to miss at the bottom of the page (I've had the same issue as you in the past). The gdalwarp page says: Mosaicing into an existing output file is supported if the output file already exists. The spatial extent of the existing file will not be modified to accomodate new data, so you may have to remove it in that case, or use the -overwrite option. –  MerseyViking Aug 8 '11 at 8:46

1 Answer 1

I don't know if there is something wrong in your command strings, but you can also use QGIS, who has nice GUIs for the gdal utilities and it works also in batch mode. Using QGIS raster tools (gdal tools) it useful also because when you choose the parameters it show you a window with the actual CLI string that will be used.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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