2

How to delete GCP set in GEOTIFF?

I have some GEOTIFF files. They have been set for GCP, but I made a mistake. Therefore, I want to take the following procedure.

  1. Delete the set GCP.
  2. Grant new GCP.

2 is I know.

gdal_translate - gcp [col plxel] [row plxel] [lon] [lat] [input file name] [output file name]

However, I do not know the method of 1.

1 Answer 1

1

By looking at the GDAL documentation https://www.gdal.org/classGDALDataset.html#ac91ea1fc26dd19f14d31baec4988d5b6 there are methods for setting ground control points and for reading a list of existing ones but not one for editing the GCP list. Therefore it seems that you can't actually remove or edit one GCP but you must delete them all and add a corrected list of ground control points.

With command line tools I would

  • read the existing GCPs with gdalinfo
  • write a corrected list in format [-gcp pixel line easting northing [elevation]]*
  • delete existing georeference with gdal_edit https://www.gdal.org/gdal_edit.html

gdal_edit.py -unsetgt image.tif

  • add correct list of ground control points with gdal_edit

Gdal_edit is a Python script and requires that GDAL Python bindings and correct Python version are available and correctly configured. If you use Windows then OSGeo4W is perhaps easiest way for making all work out-of-the-box. Gdal_edit edits the TIFF metadata in place which is faster than to make a new copy of the image file with gdal_translate.

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.