对于主题2:这是对JP2的更长篇研究,因为我也有兴趣使用更有效的压缩。IMO的结果是:在GDAL / QGIS(作为QgsRastrerDataProvider)中,您无法以简单的方式结合适当的jpeg2000压缩和快速缓存选项(如图块集和块结构)。
通常,我认为GeoTiff是Raster-DB的,它很久以来就得到了GDAL的良好支持,并具有许多使生活更轻松的功能。
您可以在gdal页面上找到数据驱动器JP2的功能。为了您的需要jp2k,在此页面上列出了JPEG2000(libjasper依赖项):http ://www.gdal.org/frmt_jpeg2000.html 。如http://www.gdal.org/formats_list.html上列出的,“驱动程序”支持读取,写入,并且自GDAL 1.9版开始限制为2GiB并内置,并且具有某些块选项...
为了确定JP2有什么可能,我创建了一个测试仪。
我使用大型arial照片检测波罗的海中海鸟的大小,大约为。12000 x 10000像素(RGB),地面分辨率为2厘米(我希望它足够大)。目前,我的QGIS项目中有270个文件,容量约为130 GiB。而且,它在具有8GB和4xAMD Opteron内核的64位Debian 7.0 Linux操作系统上运行流畅且性能良好。...但是使用GeoTiff。
为了在GIS工具中快速访问,请使用以下步骤和选项(..sorry为bash脚本样式)对GDAL图像进行引用和重新采样:
使用来自gps-log的数据集引用图像:
gdal_translate \
-of GTiff \
-gcp 0 0 $ulx $uly \
-gcp 0 $hg $llx $lly \
-gcp $cwd $chg $cpx $cpy \
-gcp $wd 0 $urx $ury \
-gcp $wd $hg $lrx $lry \
-a_srs epsg:32632 \
$raw_tif $ref_tif
变量$ [u | o] [l | r] [x | y]是由摄影语法计算的图像角,变量$ wd是图像宽度,$ hg是图像高度,$ cwd $ chg是中心点。
使用图块集选项将图像扭曲到真实世界中:
gdalwarp \
--config GDAL_CACHEMAX 2000 -wm 2000 -wo NUM_THREADS=4 \
-r bilinear -dstnodata '0 0 0' \
-of GTiff \
-t_srs epsg:32632 \
-tr 0.02 0.02 \
-co COMPRESS=LZW \
-co TILED=YES \
-co BLOCKXSIZE=512 \
-co BLOCKYSIZE=512 \
$ref_tif $geo_tif
参数:--config GDAL_CACHEMAX 2000 -wm 2000 -wo NUM_THREADS = 4告诉Iron使用大量缓存和四个处理器线程来计算数据。重采样是通过双线性方式完成的,坐标系统是UTM-32 ..但我想要512x512的块图块,以使导航操作(缩放,平移,指向)快速流畅。这是通过选项-co TILED = YES -co BLOCKXSIZE = 512 -co BLOCKYSIZE = 512完成的。
将金字塔以2、4、8和16缩放级别写入GeoTiff。
gdaladdo -r gauss $geo_tif 2 4 8 16
gdalinfo显示的结果GeoTiff为:
Driver: GTiff/GeoTIFF
Files: CF006135.TIF
Size is 12419, 9900
Coordinate System is:
PROJCS["WGS 84 / UTM zone 32N",
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"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",9],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","32632"]]
Origin = (656099.007276594405994,5998980.139660121873021)
Pixel Size = (0.020000000000000,-0.020000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 656099.007, 5998980.140) ( 11d23'17.54"E, 54d 6'54.87"N)
Lower Left ( 656099.007, 5998782.140) ( 11d23'17.17"E, 54d 6'48.47"N)
Upper Right ( 656347.387, 5998980.140) ( 11d23'31.21"E, 54d 6'54.60"N)
Lower Right ( 656347.387, 5998782.140) ( 11d23'30.84"E, 54d 6'48.20"N)
Center ( 656223.197, 5998881.140) ( 11d23'24.19"E, 54d 6'51.54"N)
Band 1 Block=512x512 Type=Byte, ColorInterp=Red
NoData Value=0
Overviews: 6210x4950, 3105x2475, 1553x1238, 777x619
Band 2 Block=512x512 Type=Byte, ColorInterp=Green
NoData Value=0
Overviews: 6210x4950, 3105x2475, 1553x1238, 777x619
Band 3 Block=512x512 Type=Byte, ColorInterp=Blue
NoData Value=0
Overviews: 6210x4950, 3105x2475, 1553x1238, 777x619
因此,在GeoTiff中,一切都很好!如果我尝试通过直接对话步骤创建JP2:
gdalwarp -of jpeg2000 -co TILED=YES -co BLOCKSIZEX=512 -co BLOCKSIZEY=512 CF006135.TIF CF006135.jp2
Output driver `jpeg2000' not recognised or does not support
direct output file creation. The following format drivers are configured
and support direct output:
VRT: Virtual Raster
GTiff: GeoTIFF
NITF: National Imagery Transmission Format
HFA: Erdas Imagine Images (.img)
ELAS: ELAS
MEM: In Memory Raster
BMP: MS Windows Device Independent Bitmap
PCIDSK: PCIDSK Database File
ILWIS: ILWIS Raster Map
SGI: SGI Image File Format 1.0
Leveller: Leveller heightfield
Terragen: Terragen heightfield
netCDF: Network Common Data Format
HDF4Image: HDF4 Dataset
ISIS2: USGS Astrogeology ISIS cube (Version 2)
ERS: ERMapper .ers Labelled
RMF: Raster Matrix Format
RST: Idrisi Raster A.1
INGR: Intergraph Raster
GSBG: Golden Software Binary Grid (.grd)
PNM: Portable Pixmap Format (netpbm)
ENVI: ENVI .hdr Labelled
EHdr: ESRI .hdr Labelled
PAux: PCI .aux Labelled
MFF: Vexcel MFF Raster
MFF2: Vexcel MFF2 (HKV) Raster
BT: VTP .bt (Binary Terrain) 1.3 Format
LAN: Erdas .LAN/.GIS
IDA: Image Data and Analysis
GTX: NOAA Vertical Datum .GTX
NTv2: NTv2 Datum Grid Shift
ADRG: ARC Digitized Raster Graphics
SAGA: SAGA GIS Binary Grid (.sdat)
它失败了。错误消息可能会为您提供线索或可以使用的其他格式。
尝试使用gdal_translate工具会给您合适的JP2000
gdal_translate -of jpeg2000\
-co TILED=YES -co BLOCKSIZEX=512 -co BLOCKSIZEY=512\
CF006135.TIF CF006135.jp2
ls -l
-rw-r--r-- 1 huckfinn huckfinn 63538529 Jan 28 23:55 CF006135.jp2
-rw-r--r-- 1 huckfinn huckfinn 388 Jan 28 23:04 CF006135.jp2.aux.xml
-rw-r--r-- 1 huckfinn huckfinn 519882980 Sep 30 21:01 CF006135.TIF
压缩率为1:8,但我们松开了块和图块集属性,如gdalinfo所示:
gdalinfo CF006135.jp2
Driver: JPEG2000/JPEG-2000 part 1 (ISO/IEC 15444-1)
Files: CF006135.jp2
CF006135.jp2.aux.xml
Size is 12419, 9900
Coordinate System is:
PROJCS["WGS 84 / UTM zone 32N",
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"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",9],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","32632"]]
Origin = (656099.007276594405994,5998980.139660121873021)
Pixel Size = (0.020000000000000,-0.020000000000000)
Metadata:
AREA_OR_POINT=Area
Corner Coordinates:
Upper Left ( 656099.007, 5998980.140) ( 11d23'17.54"E, 54d 6'54.87"N)
Lower Left ( 656099.007, 5998782.140) ( 11d23'17.17"E, 54d 6'48.47"N)
Upper Right ( 656347.387, 5998980.140) ( 11d23'31.21"E, 54d 6'54.60"N)
Lower Right ( 656347.387, 5998782.140) ( 11d23'30.84"E, 54d 6'48.20"N)
Center ( 656223.197, 5998881.140) ( 11d23'24.19"E, 54d 6'51.54"N)
最后的测试是将GeoTiff与内部JPEG压缩一起使用,但我们得到:
gdalwarp -of GTiff \
-co COMPRESS=JPEG \
-co TILED=YES -co BLOCKSIZEX=512 -co BLOCKSIZEY=512\
CF006135.TIF CF006135_IJPG.TIF
Creating output file that is 12419P x 9900L.
Warning 6: Driver GTiff does not support BLOCKSIZEX creation option
Warning 6: Driver GTiff does not support BLOCKSIZEY creation option
Processing input file CF006135.TIF.
....
那么从这里去哪里。GDAL的JP2000 Jasper驱动程序lib页面列出了一些参数,用于创建带有块选项的jp2000映像:
Encoding parameters, directly delivered to the JasPer library described in the JasPer documentation. Quoted from the docs:
``The following options are supported by the encoder:
imgareatlx=x Set the x-coordinate of the top-left corner of the image area to x.
imgareatly=y Set the y-coordinate of the top-left corner of the image area to y.
tilegrdtlx=x Set the x-coordinate of the top-left corner of the tiling grid to x.
tilegrdtly=y Set the y-coordinate of the top-left corner of the tiling grid to y.
tilewidth=w Set the nominal tile width to w.
tileheight=h Set the nominal tile height to h.
prcwidth=w Set the precinct width to w. The argument w must be an integer power of two. The default value is 32768.
prcheight=h Set the precinct height to h. The argument h must be an integer power of two. The default value is 32768.
cblkwidth=w Set the nominal code block width to w. The argument w must be an integer power of two. The default value is 64.
cblkheight=h Set the nominal code block height to h. The argument h must be an integer power of two. The default value is 64.
但是问题是,qgis将使用哪个。