TransWikia.com

What is the proper way to georeference an image based on GCP using GDAL tools

Geographic Information Systems Asked by rughimire on July 18, 2021

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

One Answer

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

Answered by Zoltan on July 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP