0

I am trying to do the Georeferencing using CLI provided by the GDAL as it is doing in the QGIS. Tools useful are

  • gdal_traslate
  • gdalwrap
  • gdaltransform

I have a gcps as below:

-gcp 3.5665368079674 172.382039707818 622077.13 3065767.9025 -gcp 245.303236050418 444.414309600493 622131.912491862 3065830.02579297 -gcp 634.581598372123 423.326092755138 622220.817025879 3065825.27750895 -gcp 303.968713236919 25.9583397712343 622145.74925 3065734.5255

I want the Geocoded-TIF image without GCP on it. How to achieve this with GDAL Tools without QGIS but as exact Output of QGIS-Georeferencer.

Source Image

1 Answer 1

2

uou can use first gdal_translate to add GCPs to your image. I changed the pixel coordinates of GCPs to integer values (there is no much use of sub-pixel coordinates)

gdal_translate -gcp 4 172 622077.13 3065767.9025 \
-gcp 245 444 622131.912491862 3065830.02579297 \
-gcp 635 423 622220.817025879 3065825.27750895 \
-gcp 304 26 622145.74925 3065734.5255 RzKaN.png RzKaN_gcp.tif

In the second step using gdalwarp you can apply the GCPs for image transformation:

gdalwarp -r near -order 1 RzKaN_gcp.tif RzKaN_warped.tif

I used the nearest neighbor (-r near) interpolation as you image is black and white (not to blur the lines) and linear transformation (-order 1). Unfortunately I don't know the SRS for your GCPs, you should set target SRS with gdalwarp, too:

gdalwarp -r near -order 1 -t_srs EPSG:nnnn RzKaN_gcp.tif RzKaN_warped.tif

Substitute nnnn with the ESPG ID of your projection (if you know it).

Here is the result of transformation (image upside down):

enter image description here

2
  • I am working with EPSG:6207. The image should be be upside down. That is the issue what I am facing now. Is there any issue on source image? This was saved using normal photo editor. If I do this with QGIS, the image is not upside down. Just shifts the location as GCPs
    – rughimire
    Commented May 1, 2020 at 9:32
  • The origin of the image (pixel) coordinates is the upper-left corner. I suppose your row coordinates are from the lower-left corner.
    – Zoltan
    Commented May 1, 2020 at 11:44

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.