作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 ESRI ASCII 文件,格式如下:
ncols 5
nrows 4
xllcorner 0
yllcorner 0
cellsize 10
NODATA_value -9999
25.4 26.1 27 28.6 27.7
25 26 26.4 27.9 27.4
25.1 25.8 26.8 28.6 27.6
27.5 28 27.7 30.6 28.3
TIFFTAG_IMAGEWIDTH
,
TIFFTAG_SAMPLESPERPIXEL
或
TIFFTAG_BITSPERSAMPLE
我不知道它们是否相关。
最佳答案
实际上,这项任务可以通过使用 GDAL 库(或其 .Net 等效项 GDAL.Net)轻松完成。甚至还有an example here在 Python 中:
ncols 174
nrows 115
xllcorner 14.97
yllcorner -34.54
cellsize 0.11
if __name__ == '__main__':
# Import libs
import numpy, os
from osgeo import osr, gdal
# Set file vars
output_file = "out.tif"
# Create gtif
driver = gdal.GetDriverByName("GTiff")
dst_ds = driver.Create(output_file, 174, 115, 1, gdal.GDT_Byte )
raster = numpy.zeros( (174, 115) )
# top left x, w-e pixel resolution, rotation, top left y, rotation, n-s pixel resolution
dst_ds.SetGeoTransform( [ 14.97, 0.11, 0, -34.54, 0, 0.11 ] )
# set the reference info
srs = osr.SpatialReference()
srs.SetWellKnownGeogCS("WGS84")
dst_ds.SetProjection( srs.ExportToWkt() )
# write the band
dst_ds.GetRasterBand(1).WriteArray(raster)
关于mesh - 给定最小的 ESRI ASCII 文件,在 libtiff 或 libgeotiff 中设置的相应字段是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53588712/
我正在尝试使用 GeoTiff 库创建一个 tif 文件。我设法使用库的标准 TIF 函数将所有数据写入一个普通的 tif 文件,但我不知道如何使用这些函数来添加角的坐标。 例如,我在 Interne
在(部分)libgeotiff API 中 documentation ,以下函数的返回值含义不详: GTIFWriteKeys GTIFKeySet 这些函数将返回哪些可能的返回值?这些值是什么意思
我有一个 ESRI ASCII 文件,格式如下: ncols 5 nrows 4 xllcorner 0 yllcorner 0 cellsize
我是一名优秀的程序员,十分优秀!