问题描述
我有一张没有地理数据的TIFF格式图片(地图)。
我需要从我的图片中获取GeoTIFF文件。我有我的地图每个角落的经度和纬度。如何将我的地理位置数据添加到Google空间反应中的图像中以获取geotiff?我需要一个可以做到这一点的工具。 解决方案
我有一张没有地理数据的TIFF格式图片(地图)。
我需要从我的图片中获取GeoTIFF文件。我有我的地图每个角落的经度和纬度。如何将我的地理位置数据添加到Google空间反应中的图像中以获取geotiff?我需要一个可以做到这一点的工具。 解决方案
您的答案中有正确的想法,但允许我扩展。你是对的,你需要使用gdal_translate工具来设置地面控制点(gcps)来对图像进行地理配准。但命令行参数应该如下所示:
gdal_translate -of GTiff -a_srs EPSG:4326 -gcp [东北向的像素线] -gcp [像素线东向北] -gcp [像素线东向北] sourcefile outpulfile
你不用如果你想对你的文件执行其他算法,给它添加更多的数据集,最终将它输出为KML,其他的你可以在这里阅读()。但为此目的,将 -of
设置为GTiff是理想选择。
- a_srs EPSG:4326
接下来,在空间参考中您应该引用WGS84的坐标系统使用谷歌地球,但我们指定它使用 EPSG:4326
- 这只是地理信息委员会已同意在全球范围内识别坐标系的编码方案()。
-gcp [像素线东向北行]
地面控制点可能是最棘手的命令行参数的一部分。前两个数字表示实际图像的像素和线条坐标,例如(0,0)表示图像的左上角。应该遵循的第二组数字是应该引用图像的相应纬度/经度坐标。现在,您只需要这些 -gcps
中的3个,因为如果您的图片是方形/矩形,则会确定第四个。
sourcefile outpulfile
这部分应该是不言而喻,只要记住它们都是* .tif文件。
现在,如果您需要做最后一件事情来完成您的任务。您将不得不实际将图像投影到坐标系以使其对齐。这是使用 gdalwarp
命令()。
gdalwarp -t_srs EPSG:4326 sourcefile输出文件
您必须指定 -of
(输出fileformat)应该是GeoTiff以外的东西 - 但默认格式是GTiff,所以你不需要指定它。
I have an image (map) without geo data in TIFF format.
I need to get GeoTIFF file from my image. I have latitude and longitude for each corner of my map. How can I add my geo data to my image in Google spatial refence to get geotiff? I need a tool that can do this.
You have the right idea in your answer but allow me to expand. You are correct, you'll need to use the gdal_translate tool to set ground control points (gcps) to georeference the image. But the command line argument should go like so:
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 don't necessarily have to output to a VRT, VRT's are useful if you want to perform other algorithms to your file, add more datasets to it, eventually output it as a KML - amongst others which you can read up on here ( http://www.gdal.org/gdal_vrttut.html ). But for this purpose setting -of
to GTiff is ideal.
-a_srs EPSG:4326
Next, in the spatial reference you are correct it should be referenced to WGS84 the coordinate system used by google earth, however we specify it using EPSG:4326
- this is just the coding scheme the Geomatics Committee has agreed on to identify coordinate systems worldwide ( http://www.epsg.org/ ).
-gcp [pixel line easting northing]
The ground control points, are probably the most trickiest part of the command line argument. The first 2 numbers represent the pixel and line coordinate of your actual image, for instance (0,0) for the top left most corner of your image. The second set of numbers that should follow is the corresponding lat/long coordinates that your image should be referenced to. Now, you'll only need 3 of these -gcps
because the 4th one will be determined if your image is a square/rectangle.
sourcefile outpulfile
This part should be self-explanatory, just remember they are both *.tif files.
Now, there if one last thing you will need to do to complete your task. You will have to actually project the image to the coordinate system for it to be aligned. This is down using the gdalwarp
command ( http://www.gdal.org/gdalwarp.html ).
gdalwarp -t_srs EPSG:4326 sourcefile outputfile
You'll have to specify an -of
(output fileformat) if it was supposed to something other than a GeoTiff - but the default format is GTiff so you don't need to specify it.
这篇关于从tiff和4个角落的经纬度创建geotiff的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!