Create a geotype from tiff and 4 angles of latitude and longitude

I have an image (map) without geodata in TIFF format.
I need to get a GeoTIFF file from my image. I have latitude and longitude for every corner of my map. How can I add my geodata to my image in Google spatial confirmation to get a geotype? I need a tool that can do this.

+7
source share
2 answers

You have the right idea in your answer, but let me expand. You're right, you need to use the gdal_translate tool to set ground control points (gcps) to snap the image. But the command line argument should look like this:

gdal_translate -of GTiff -a_srs EPSG:4326 -gcp [pixel line easting northing] -gcp [pixel line easting northing] -gcp [pixel line easting northing] sourcefile outpulfile 

You do not need to output to VRT, VRT are useful if you want to execute other algorithms in your file, add more data sets to it, ultimately display them as KML - among others that you can read here ( http: //www.gdal .org / gdal_vrttut.html ). But for this, setting -of in GTiff is ideal.

 -a_srs EPSG:4326 

Further, in the spatial reference you are right, the WGS84 coordinate system used by Google Earth should refer to it, however we indicate it using EPSG:4326 - this is only the coding scheme agreed by the Committee on Geomatics to determine the coordinates of systems around the world ( http: / /www.epsg.org/ ).

 -gcp [pixel line easting northing] 

Ground control points are probably the most difficult part of the command line argument. The first 2 numbers represent the pixel and line coordinates of your actual image, for example (0,0) for the upper left corner of your image. The second set of numbers to follow is the corresponding lat / long coordinates that your image should reference. Now you only need 3 of these -gcps , because the fourth will be determined if your image is a square / rectangle.

 sourcefile outpulfile 

This part should be clear, just remember that they are both * .tif files.

Now, if you need the last thing you need to do to complete your task. You will need to project the image into the coordinate system to align it. This happens with the gdalwarp ( http://www.gdal.org/gdalwarp.html ).

 gdalwarp -t_srs EPSG:4326 sourcefile outputfile 

You need to specify -of (output fileformat) if it was intended for something other than GeoTiff, but the default format is GTiff, so you don't need to specify it.

+9
source

gdal_translate -of VRT -a_srs WGS84 -a_ullr 55.7254060 37.5516230 55.7248920 37.5569120 source image of the target image
gdal_translate -of VRT -a_srs "spatial reference" -a_ullr "left top lat / long" "right bottom lat / long" source image of the target image

+5
source

All Articles