0

我正在尝试将一些(Matlab 生成的)GeoTIFF 文件导入 WorldWind,但似乎没有任何运气。任何有用的提示将不胜感激。GeoTIFF 文件在 ArcGIS 中显示良好(允许我在导出时创建一个 .tfw 文件),但 WorldWind 给了我以下消息:

SEVERE: Cannot read raster: C:\Users\Matthias\Desktop\geotiff\fldextent_02- 
Jan-1977(1)renderedno0.tif : gov.nasa.worldwind.formats.tiff.GeotiffImageReader.read(): unable
to decipher image organization
Jul 09, 2013 6:54:33 PM gov.nasa.worldwind.data.CachedDataRaster drawOnTo
SEVERE: C:\Users\Matthias\Desktop\geotiff\fldextent_02-Jan-1977(1)renderedno0.tif : Cannot read
raster: C:\Users\Matthias\Desktop\geotiff\fldextent_02-Jan-1977(1)renderedno0.tif : 
gov.nasa.worldwind.formats.tiff.GeotiffImageReader.read(): unable to decipher image organization
gov.nasa.worldwind.exception.WWRuntimeException: Cannot read raster: C:\Users\Matthias\Desktop
\geotiff\fldextent_02-Jan-1977(1)renderedno0.tif :
gov.nasa.worldwind.formats.tiff.GeotiffImageReader.read(): unable to decipher image organization
   at gov.nasa.worldwind.data.CachedDataRaster.getDataRasters(CachedDataRaster.java:255)
   at gov.nasa.worldwind.data.CachedDataRaster.drawOnTo(CachedDataRaster.java:290)
   at gov.nasa.worldwind.data.TiledRasterProducer.drawDataSources(TiledRasterProducer.java:576) 
[...]

我还查看了 FWTools 中 GeoTIFF 文件的属性,这给了我:

C:\Users\Matthias\Desktop\geotiff>gdalinfo fldextent_02-Jan-1977(1)renderedno0.tif
Driver: GTiff/GeoTIFF
Files: fldextent_02-Jan-1977(1)renderedno0.tif
   fldextent_02-Jan-1977(1)renderedno0.tfw
Size is 7200, 7200
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (99.000000000000000,7.000000000000000)
Pixel Size = (0.000833333333333,-0.000833333333333)
Metadata:
   AREA_OR_POINT=Area
Image Structure Metadata:
   INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  99.0000000,   7.0000000) ( 99d 0'0.00"E,  7d 0'0.00"N)
Lower Left  (  99.0000000,   1.0000000) ( 99d 0'0.00"E,  1d 0'0.00"N)
Upper Right ( 105.0000000,   7.0000000) (105d 0'0.00"E,  7d 0'0.00"N)
Lower Right ( 105.0000000,   1.0000000) (105d 0'0.00"E,  1d 0'0.00"N)
Center      ( 102.0000000,   4.0000000) (102d 0'0.00"E,  4d 0'0.00"N)
Band 1 Block=128x128 Type=Byte, ColorInterp=Gray
    NoData Value=0        

.tfw 文件内容如下:

0.0008333333
0.0000000000
0.0000000000
-0.0008333333
99.0004166667
6.9995833333
4

1 回答 1

0

我终于找到了问题:

重要的是在 Matlab 中创建一个 CLEAN GeoTIFF 文件(用于透明度的 RGB 和 alpha 层)。这里有一些 Matlab 指导,生成的 GeoTIFF 可以直接导入 WorldWind:

%%% read intensity values Z (2D matrix) - with values of 0 and above 
%%% (we want 0 to be completely transparent in the final geotiff) - 
%%% together with spatialref.GeoRasterReference ss
[Z, ss] = geotiffread('./flddph_1976-01-01.tif');
info_3 = geotiffinfo('./flddph_1976-01-01.tif');

%%% generate indexed image with 0 to 255 (255 equals max. intensity)
indexedimage = gray2ind(Z);
indexedimage = double(indexedimage);

%%% normalize so that everything between 0 and 1
normalizedimg = (indexedimage) / 255;

%%% scaling data and applying colormap
imgscaled = uint8(256*normalizedimg); % scale data

cmp = makeColorMap([1 1 0],[1 0.75 0],[1 0 0],256); 
% 256 element colormap yellow - orange - red 
% (download appropriate function MAKECOLORMAP)
imgrgb = ind2rgb(imgscaled,cmp);

%%% check plot
% subplot(2,1,1)
% imagesc(indexedimage)
% title('indexed image')
% subplot(2,1,2)
% image(img)
% title('rgb image')

%%% generating alpha layer for transparency 
%%% (255 for non-transparent, 0 for transparent)

alpha3 = Z;
alpha3(alpha3>0)=255;
alpha3 = uint8(alpha3);

out2 = cat(3,imgrgb,alpha3);

geotiffwrite('test_rgbhope_flddph.tif',out2,ss);
于 2013-07-11T22:34:03.007 回答