GeoTIFF

image

[GeoTIFF] raster file=/home/map/300km/new/elevation/L13/elevation.tif width=2560 height=2048 samplesPerPixel=1 bitsPerSample=32 sampleFormat=3
[GeoTIFF] transform pixelSizeX=0.001373291016 rotationY=0.000000000000 rotationX=0.000000000000 pixelSizeY=-0.001373291016 topLeftCenterX=111.006546020508 topLeftCenterY=37.177047729492
[GeoTIFF] requestedMapBounds left=111.5000000000 right=111.6000000000 top=36.1000000000 bottom=36.2000000000 width=0.1000000000 height=0.1000000000
[GeoTIFF] fullElevationBounds left=111.0058593750 right=114.5214843750 top=34.3652343750 bottom=37.1777343750 width=3.5156250000 height=2.8125000000
[GeoTIFF] resolvedMapBounds left=111.5000000000 right=111.6000000000 top=36.1000000000 bottom=36.2000000000 width=0.1000000000 height=0.1000000000
[GeoTIFF] pixel(0,0)->map x=111.0065460205 y=37.1770477295
[GeoTIFF] pixel(width-1,height-1)->map x=114.5207977295 y=34.3659210205
[GeoTIFF] resolved topLeft map->pixel x=359.3222222222 y=784.2822222222
[GeoTIFF] resolved bottomRight map->pixel x=432.1400000000 y=711.4644444444
elevation size: 79 79
water: 2
airport: 0

结论:GeoTIFF 坐标读取是正确的,你的打印结果和 txt 里的坐标范围能对上。

关键对应关系:

宽度/高度:
日志 2560 x 2048
txt  2560 x 2048
一致

GeoTIFF 解析出来的范围:

left   = 111.0058593750
right  = 114.5214843750
minY   = 34.3652343750
maxY   = 37.1777343750

和 txt 里的四个坐标值一致。

topLeftCenterX/Y 也合理,因为代码内部存的是左上像素中心点,而 txt 里通常给的是图像外边界角点

left boundary = 111.005859375
pixelSizeX    = 0.001373291016
centerX       = left + 0.5 * pixelSizeX
              = 111.006546020508

日志正好是:

topLeftCenterX=111.006546020508

Y 方向同理:

north boundary = 37.177734375
pixelSizeY     = -0.001373291016
centerY        = north + 0.5 * pixelSizeY
               = 37.177047729492

也和日志一致。

elevation size: 79 79 也是对的。你的请求范围是 0.1° x 0.1°

0.1 / 0.001373291016 ≈ 72.8 像素

再加上代码里的四周 paddingPixels = 2,并经过 floor/ceil,最后得到 79 x 79,这个结果正常。

有一个需要注意的小点:日志里的:

top=34.3652343750
bottom=37.1777343750

这是 QRectF 的命名习惯,top 是较小的 Y,不等于地理上的“北边”。地理上应该理解为:

south = 34.3652343750
north = 37.1777343750

另外,txt 里的“空间分辨率:38.2185米/像素”和当前坐标范围不太一致。按坐标范围计算:

经度方向:3.515625° / 2560 = 0.001373291016°/像素
纬度方向:2.8125° / 2048 = 0.001373291016°/像素

在 36° 纬度附近,这大约不是 38 米/像素,而是百米级。所以这个“38.2185米/像素”可能是工具按比例尺估算的显示分辨率,或者来自另一个层级/原始数据,不像是当前 GeoTIFF tag 的真实地理像素尺寸。

建议下一步把 debug 里的 top/bottom 改成 south/north,避免后面继续被 Qt 的矩形命名绕一下。

posted @ 2026-05-26 14:46  twjy  阅读(6)  评论(0)    收藏  举报