GeoTiff读取
形容秋天的句子-濮阳市人事考试网
GeoTiff格式读取注意事项:
1.GeoKey
directory前4个数值为头信息;
2.GeoTiff修正号表示为
3.Header={KeyDirectoryVersion, KeyRevision,
MinorRevision,
NumberOfKeys}目前DirectoryVersion
号为1,NumberOfKeys表明Key的
个数
4.KeyEntry = {
KeyID, TIFFTagLocation, Count, Value_Offset }
其中,TIFFTagLocation表示哪个tag存放值,如果值为0则表示值为
SHORT类型
且包含在Value_Offset元素中;
此外还有GeoTagDoubleParams双精度
型,该域ID号为34736,保存不定
个数的double型GeoKeys,FLOAT要转化成d
ouble型才能存在该种Tag
中;
GeoTagASCIIParamsASCII型,
该域ID号为34737,保存不定长度的
ASCII型GeoKeys,每个GeoKey结束的位置
加一个分割字符“|” ,一般只
有Citation的Key才为ASCII型;
5.GeoTiff支持的3种坐标空间(如文章);
6.GeoTiff中6个GeoTa
g域的具体含义(如文章),注意其中对于
KeyEntry内容的详细描述;
7.图像数据地理编码的具体步骤(如文章);
8.栅格空间向模型空间的转换步骤(如文章);
9.举例,如下:
GeoKeyDirectoryTag=( 1, 1, 2, 6,
1024, 0,
1, 2,
1026, 34737,12, 0,
2048, 0, 1,
32767,
2049, 34737,14, 12,
2050, 0, 1, 6,
2051, 34736, 1, 0 )
GeoDoubleParamsTag(34736)=(1.5)
Geo
AsciiParamsTag(34737)=(
第一行表明这是一个版本号为1的GeoTIFF
GeoKey目录,键的版本为Rev.
1.2,在这个标签中定义了6个键。
下一行定义第一个键(ID=1024 = GTModelTypeGeoKey),值为2(Geo
graphic),
直接放在元素列表中(因为TIFFTagLocation=0);
下一行键1026(the GTCitationGeoKey),列在GeoAsciiParam
sTag(34737)数组
中开始于偏移0,数到第12个字节,所以其值为(”|”被转换
为结束符了)
再下面一行,键2051(GeogLinearUnitSizeGeoKey)
位于GeoDoubleParamsTag
(34736), 偏移为0所以值为1.5
key2049的值为(GeogCitationGeoKey) is 。
10.怀疑在TIFF中用SamplesPerPixel,
PlanarConfiguration,
ExtraSamples来表示
多光谱数据,应该从这些地方入手,察看!
11.
以下为地理坐标与投影坐标转换的示意:
Projected_CS = Geographic_CS + Projection
Geographic_CS = Angular_Unit + Geodetic_Datum +
Prime_Meridian
Projection = Linear
Unit + Coord_Transf_Method + CT_Parameters
Coord_Transf_Method = { TransverseMercator |
LambertCC | ...}
CT_Parameters =
{OriginLatitude + StandardParallel+...}
12.纬度赤
道以北为正,赤道以南为负;经度本初子午线以东为正,以西为
负;GeoTiff中也包括了不以格林
尼治天文台为零点的经度
13.在用地理坐标系描述一个点时,地球和椭球的关系一定要定义
14.A geographic coordinate system has two
axes, latitude and longitude, which are
only
unambiguous when both of the related prime
meridian and geodetic datum are
given, and in
turn the geodetic datum definition includes the
definition of an
ellipsoid地理坐标系定义需要的条件:经纬度,本初子午线,大地基准点
15.
ModelPixelScaleTag
ModelTiepointTag
R ------------
OR --------------> M
(I,J,K)
ModelTransformationTag (X,Y,Z)
表示将栅格图像空间和模型空间绑在一起,表示模型空间如何将坐标与地球相
应
16
.ModelPixelScaleTag(在图像发生旋转和剪切时不能使用该Tag)和
TiePo
int:通过这两个来表示图像空间和模型空间之间的关系
17.ModelTransformationTag =
(a,b,c,d,e....m,n,o,p):如果ModelTiepointTag和
Mod
elPixelScaleTag已经定义,则不定义该标签,在定义一个Tiepoint和
Mode
lPixelScale可以计算该转换矩阵
18.下面给出了如何定义一个栅格图像空间坐标所需要的Tag
Here is a
4-step guide to producing a set of Baseline
GeoTIFF tags for defining
coordinate
transformation information of a raster dataset.
Step 1: Establish the Raster Space
coordinate system used:
RasterPixelIsArea or RasterPixelIsPoint.
Step 2: Establishdefine the model space Type in
which the image is to be georeferenced.
Usually this will be a Projected Coordinate
system (PCS). If you are geocoding this data
set, then the model space is defined to be the
corresponding geographic, geocentric or
Projected coordinate system (skip to the
this).
Step 3: Identify the nature of
the transformations needed to tie the raster data
down to
the model space coordinate system:
注意以下情况分类考虑,读写都要考虑
Case 1: The
model-location of a raster point (x,y) is known,
but not the scale or
orientations:Use the
ModelTiepointTag to define the (X,Y,Z) coordinates
of the known
raster point.
Case 2: The
location of three non-collinear raster points are
known exactly, but
the linearity of the
transformation is not known. Use the
ModelTiepointTag to define the
(X,Y,Z)
coordinates of all three known raster points. Do
not compute or define the
ModelPixelScale or
ModelTransformation tag.
Case 3: The position
and scale of the data is known exactly, and no
rotation or
shearing is needed to fit into the
model space. Use the ModelTiepointTag to define
the
(X,Y,Z) coordinates of the known raster
point, and the ModelPixelScaleTag to specify the
scale.
Case 4: The raster data
requires rotation andor lateral shearing to fit
into the defined
model space: Use the
ModelTransformation matrix to define the
transformation.
Case 5: The
raster data cannot be fit into the model space
with a simple affine
transformation (rubber-
sheeting required). Use only the ModelTiepoint
tag, and specify as
many tiepoints as your
application requires. Note, however, that this is
not a Baseline
GeoTIFF implementation, and
should not be used for interchange; it is
recommended that
the image be geometrically
rectified first, and put into a standard projected
coordinate
system.
Step 4: Install the
defined tag values in the TIFF file and close it.
19.Cookbook for Geocoding Data
Geocoding的整个流程
Step 1: Determine the
Coordinate system type of the raster data, based
on the nature of
the data: pixels derived from
scanners or other optical devices represent areas,
and most
commonly will use the
RasterPixelIsArea coordinate system. Pixel data
such as digital
elevation models represent
points, and will probably use RasterPixelIsPoint
coordinates.
Store in:
GTRasterTypeGeoKey保存栅格图像的信息
Step 2: Determine
which class of model space coordinates are most
natural for this
dataset:Geographic,
Geocentric, or Projected Coordinate System.
Usually this will be
PCS.
Store
in: GTModelTypeGeoKey保存模型空间坐标系类型的信息
Step 3:
This step depends on the GTModelType:
case PCS: the PCS projection system. Most of the
PCS's used in standard State Plane
and national grid systems
are
defined, so check this list first; the EPSG index
in
section 6.4 may be useful for
this purpose.
察看6.4部分,可以得到非常有用的信息,关于标准的坐标系,保存在以下
Key中
Store in: ProjectedCSTypeGeoKey,
ProjectedCSTypeGeoKey
If coded, it
will not be necessary to specify the Projection
datum, etc for this case, since all
of those parameters
are determined
by the ProjectedCSTypeGeoKey code. Skip to
step 4 from here.
If none of
the coded PCS's match your system, then this is a
user-defined PCS. Use the
Projection code list to check for
standard projection systems.
Store
in: ProjectionGeoKey and skip to Geographic CS
case.
If none of the Projection
codes match your system, then this
is a user-defined projection. Use the
ProjCoordTransGeoKey to
specify the
coordinate transformation method (e.g. Transverse
Mercator), and all of the
associated parameters of that method.
Also define the linear units used in the planar
coordinate
system.
Store in: ProjCoordTransGeoKey,
ProjLinearUnitsGeoKey
Now continue on to define the Geographic CS,
below.
case GEOCENTRIC:
case GEOGRAPHIC: Check the list of standard GCS's
and use the
corresponding code. To
use a code both the Datum, Prime
Meridian, and angular units must match those of
the code.
查找与GCS相应的基准面,本初子午线和角度单位
Store in:
GeographicTypeGeoKey and skip to Step 4.
If none of the coded GCS's match exactly, then
this is a
user-defined GCS. Check
the list of standard datums,
Prime
Meridians, and angular units to define your
system.
Store in:
GeogGeodeticDatumGeoKey, GeogAngularUnitsGeoKey,
GeogPrimeMeridianGeoKey and skip
to Step 4.
If none of the
datums match your system, you have a
user-defined datum, which is an odd system,
indeed. Use
the
GeogEllipsoidGeoKey to select the appropriate
ellipsoid
or use the
GeogSemiMajorAxisGeoKey, GeogInvFlatteningGeoKey
to
define, and give a reference
using the GeogCitationGeoKey.
Store
in: GeogEllipsoidGeoKey, etc. and go to Step 4.
Step 4: Install the GeoKeyscodes into the
GeoKeyDirectoryTag, and the
DOUBLE and
ASCII key values into the corresponding value-
tags.
Step 5: Having completely defined
the Raster & Model coordinate system,
go
to Cookbook section 2.6.2 and use the
Georeferencing Tags
to tie the raster image
down onto the Model space.
20.
Common
Examples
UTM Projected Aerial Photo
We
have an aerial photo which has been orthorectified
and resampled to a UTM grid,
zone 60, using
WGS84 datum; the coordinates of the upper-left
corner of the image is
are given in
eastingnorthing, as 350807.4m, 5316081.3m. The
scanned map pixel
scale is 100 meterspixels
(the actual dpi scanning ratio is irrelevant).
ModelTiepointTag = (0, 0, 0,
350807.4, 5316081.3, 0.0)
ModelPixelScaleTag = (100.0, 100.0, 0.0)
GeoKeyDirectoryTag:
GTModelTypeGeoKey = 1
(ModelTypeProjected)
GTRasterTypeGeoKey = 1
(RasterPixelIsArea)
ProjectedCSTypeGeoKey = 32660
(PCS_WGS84_UTM_zone_60N)
PCSCitationGeoKey =
Notes:
1) We did not need to specify the GCS lat-long,
since the
PCS_WGS84_UTM_zone_60N codes
implies particular
GCS and units
already (WGS_84 and meters). The citation
was
added just for documentation.
不需要说明GCS的经纬度,本身已经包含了这些信息
2) The
structure defined above. At the TIFF level the
tags look like
this:
GeoKeyDirectoryTag=( 1, 0, 2, 4,
1024, 0, 1,
1,
1025,
0, 1, 1,
3072, 0, 1, 32660,
3073, 34737, 25, 0 )
GeoAsciiParamsTag(34737)=(
For the rest of
these examples we will only show the GeoKey-level
dump, with the understanding that the
actual TIFF-level tag
representation can be
determined from the documentation.
Standard State Plane
We have a USGS
State Plane Map of Texas, Central Zone, using
NAD83, correctly
oriented. The map resolution
is 1000 meterspixel, at origin. There is a grid
intersection line in the image at pixel
location (50,100), and corresponds to the
projected coordinate system eastingnorthing of
(949465.0, 3070309.1).
ModelTiepointTag = ( 50, 100, 0,
949465.0, 3070309.1, 0)
ModelPixelScaleTag = (1000, 1000, 0)
GeoKeyDirectoryTag:
GTModelTypeGeoKey = 1
(ModelTypeProjected)
GTRasterTypeGeoKey = 1
(RasterPixelIsArea)
ProjectedCSTypeGeoKey = 32139
(PCS_NAD83_Texas_Central)
Notice that
in this case, since the PCS is a standard code, we
do not need to define the GCS, datum, etc,
since those are implied
by the PCS code.
Also, since this is NAD83, meters are used rather
than US Survey feet (as in NAD 27).
Lambert Conformal Conic Aeronautical Chart
We have a 500 x 500 scanned aeronautical chart
of Seattle, WA, using Lambert
Conformal Conic
projection, correctly oriented. The central
meridian is at 120
degrees west. The map
resolution is 1000 meterspixel, at origin, and
uses NAD27
datum. The standard parallels of
the projection are at 41d20m N and 48d40m N. The
latitude of the origin is at 45 degrees North,
and occurs in the image at the raster
coordinates (80,100). The origin is
given a false easting and northing of 200000m,
1500000m.
ModelTiepointTag
= ( 80, 100, 0, 200000, 1500000, 0)
ModelPixelScaleTag = (1000, 1000, 0)
GeoKeyDirectoryTag:
GTModelTypeGeoKey = 1
(ModelTypeProjected)
GTRasterTypeGeoKey = 1
(RasterPixelIsArea)
GeographicTypeGeoKey = 4267
(GCS_NAD27)
ProjectedCSTypeGeoKey
= 32767 (user-defined)
ProjectionGeoKey = 32767 (user-
defined)
ProjLinearUnitsGeoKey
= 9001 (Linear_Meter)
ProjCoordTransGeoKey = 8
(CT_LambertConfConic_2SP)
ProjStdParallel1GeoKey = 41.333
ProjStdParallel2GeoKey = 48.666
ProjCenterLongGeoKey =-120.0
ProjNatOriginLatGeoKey = 45.0
ProjFalseEastingGeoKey, = 200000.0
ProjFalseNorthingGeoKey, = 1500000.0
Notice that the Tiepoint takes the false easting
and northing into
account when tying the
raster point (50,100) to the projection origin.
DMA ADRG Raster Graphic Map
The U.S.
Defense Mapping Agency produces ARC digitized
raster graphics datasets
by scanning maps and
geometrically resampling them into an
equirectangular
projection, so that they may
be directly indexed with WGS84 geographic
coordinates.
The scale for one map is 0.2
degrees per pixel horizontally, 0.1 degrees per
pixel
vertically. If stored in a GeoTIFF file
it contains the following information:
ModelTiepointTag=(0.0, 0.0, 0.0, -120.0,
32.0, 0.0)
ModelPixelScale = (0.2,
0.1, 0.0)
GeoKeyDirectoryTag:
GTModelTypeGeoKey = 2
(ModelTypeGeographic)
GTRasterTypeGeoKey = 1
(RasterPixelIsArea)
GeographicTypeGeoKey = 4326 (GCS_WGS_84)
Unrectified Aerial photo, known
tiepoints, in degrees.
We have an aerial
photo, and know only the WGS84 GPS location of
several points in
the scene: the upper left
corner is 120 degrees West, 32 degrees North, the
lower-left
corner is at 120 degrees West, 30
degrees 20 minutes North, and the lower-right hand
corner of the image is at 116 degrees 40
minutes West, 30 degrees 20 minutes North.
The photo is not geometrically corrected,
however, and the complete projection is
therefore not known.
ModelTiepointTag=( 0.0, 0.0, 0.0, -120.0,
32.0, 0.0,
0.0,
1000.0, 0.0, -120.0, 30.33333, 0.0,
1000.0, 1000.0, 0.0, -116.6666667, 30.33333, 0.0)
GeoKeyDirectoryTag:
GTModelTypeGeoKey = 1
(ModelTypeGeographic)
GTRasterTypeGeoKey = 1
(RasterPixelIsArea)
GeographicTypeGeoKey = 4326 (GCS_WGS_84)
Remark: Since we have not specified the
ModelPixelScaleTag, clients
reading
this GeoTIFF file are not permitted to infer that
there
is a simple linear relationship
between the raster data and the
geographic model coordinate space. The only points
that are know
to be exact are the ones
specified in the tiepoint tag.
这时候不能武断的认为图像空间和模型空间是线性的关系,需要
ModelPixelScaleTag
Rotated Scanned Map
We have a scanned
standard British National Grid, covering the 100km
grid zone NZ.
Consulting documentation for BNG
we find that the southwest corner of the NZ zone
has an easting,northing of 400000m, 500000m,
relative to the BNG standard false
origin.
This scanned map has a resolution of 100 meter
pixels, and was rotated 90
degrees to fit onto
the scanner, so that the southwest corner is now
the northwest
corner. In this case we must use
the ModelTransformation tag rather than the
tiepointscale pair to map the raster data into
model space:
ModelTransformationTag = (
0, 100.0, 0, 400000.0,
100.0, 0, 0, 500000.0,
0, 0, 0, 0,
0, 0, 0, 1)
GeoKeyDirectoryTag:
GTModelTypeGeoKey = 1 (
ModelTypeProjected)
GTRasterTypeGeoKey = 1 (RasterPixelIsArea)
ProjectedCSTypeGeoKey = 27700
(PCS_British_National_Grid)
PCSCitationGeoKey =
Remark: the matrix
has 100.0 in the off-diagonals due to the 90
degree rotation;
increasing I points north,
and increasing J points east.
Digital
Elevation Model
The DMA stores digital
elevation models using an equirectangular
projection, so that
it may be indexed with
WGS84 geographic coordinates. Since elevation
postings are
point-values, the pixels should
not be considered as filling areas, but as point-
values
at grid vertices. To accommodate the
base elevation of the Angeles Crest forest, the
pixel value of 0 corresponds to an elevation
of 1000 meters relative to WGS84
reference
ellipsoid. The upper left corner is at 120 degrees
West, 32 degrees North,
and has a pixel scale
of 0.2 degreespixel longitude, 0.1 degreespixel
latitude.
ModelTiepointTag=(0.0, 0.0,
0.0, -120.0, 32.0, 1000.0)
ModelPixelScale = (0.2, 0.1, 1.0)
GeoKeyDirectoryTag:
GTModelTypeGeoKey = 2
(ModelTypeGeographic)
GTRasterTypeGeoKey = 2
(RasterPixelIsPoint)
GeographicTypeGeoKey = 4326 (GCS_WGS_84)
VerticalCSTypeGeoKey = 5030
(VertCS_WGS_84_ellipsoid)
VerticalCitationGeoKey =
VerticalUnitsGeoKey = 9001
(Linear_Meter)
Remarks:
1)
Note the
the DEM posting of the
first pixel is at the raster point
(0,0,0), and therefore corresponds to 120W,32N
exactly.
2) The third value of the
that a single pixel-value unit
corresponds to 1 meter,
and the
last tiepoint value indicates that base value
zero indicates 1000m above the reference
surface.
垂直坐标系样例及需要注意的地方
21.读写程序 我们的目标只有一个,我们将规范中要求的键值写入文件并能读出,所幸
的事,这些工作别人已经做
了,这就是著名的LibGeoTiff,它是在LibTiff基础
上实现的。
它的主要读写函数原型如下:
GTIFFree(): Free
GeoTIFF access handle.
GTIFGetDefn(): Read
and Normalize GeoTIFF Definition.
GTIFKeyGet(): Read GeoTIFF GeoKey.
GTIFKeySet(): Write GeoTIFF GeoKey.
GTIFNew(): Create GeoTIFF access handle.
GTIFWriteKeys(): Flush GeoTIFF Keys.
SetCSVFilenameHook(): Override CSV File
Searching.
XTIFFClose(): Close GeoTIFF file.
XTIFFOpen(): Open GeoTIFF file.
下面是一个例程makegeo.c:
*
* makegeo.c --
example client code for LIBGEO geographic
*
TIFF tag support.
* Author: Niles D. Ritter
* Revision History:
* 31 October, 1995
Fixed reversed lat-long coordinates NDR
#include
#include
#include
void SetUpTIFFDirectory(TIFF
*tif);
void SetUpGeoKeys(GTIF *gtif);
void
WriteImage(TIFF *tif);
#define WIDTH 20L
#define HEIGHT 20L
void
main()
{
char *fname =
TIFF *tif=(TIFF*)0; * TIFF-level descriptor *
GTIF *gtif=(GTIF*)0; * GeoKey-level descriptor
*
tif=XTIFFOpen(fname,
if (!tif) goto
failure;
gtif = GTIFNew(tif);
if
(!gtif)
{
}
SetUpTIFFDirectory(tif);
SetUpGeoKeys(gtif);
WriteImage(tif);
GTIFWriteKeys(gtif);
GTIFFree(gtif);
XTIFFClose(tif);
exit (0);
printf(
goto failure;
failure:
}
printf(
if
(tif) TIFFClose(tif);
if (gtif)
GTIFFree(gtif);
exit (-1);
void SetUpTIFFDirectory(TIFF *tif)
{
}
void SetUpGeoKeys(GTIF
*gtif)
{
GTIFKeySet(gtif, GTModelTypeGeoKey,
TYPE_SHORT, 1,
GTIFKeySet(gtif,
GTRasterTypeGeoKey, TYPE_SHORT, 1,
GTIFKeySet(gtif, GTCitationGeoKey, TYPE_ASCII,
0,
GTIFKeySet(gtif, GeographicTypeGeoKey,
TYPE_SHORT, 1,
GTIFKeySet(gtif,
GeogCitationGeoKey, TYPE_ASCII, 0,
GTIFKeySet(gtif, GeogAngularUnitsGeoKey,
TYPE_SHORT, 1,
ModelGeographic);
RasterPixelIsArea);
double
tiepoints[6]={0,0,0,130.0,32.0,0.0};
double
pixscale[3]={1,1,0};
TIFFSetField(tif,TIFFTAG_IMAGEWIDTH,
WIDTH);
TIFFSetField(tif,TIFFTAG_IMAGELENGTH,
HEIGHT);
TIFFSetField(tif,TIFFTAG_COMPRESSION,
COMPRESSION_NONE);
TIFFSetField(tif,TIFFTAG_PHOTOMETRIC,
TIFFSetField(tif,TIFFTAG_PLANARCONFIG,
TIFFSetField(tif,TIFFTAG_BITSPERSAMPLE, 8);
TIFFSetField(tif,TIFFTAG_ROWSPERSTRIP, 20L);
TIFFSetField(tif,TIFFTAG_GEOTIEPOINTS,
6,tiepoints);
TIFFSetField(tif,TIFFTAG_GEOPIXELSCALE,
3,pixscale);
PHOTOMETRIC_MINISBLACK);
PLANARCONFIG_CONTIG);
KvUserDefined);
Used.
Angular_Degree);
}
GTIFKeySet(gtif,
GeogLinearUnitsGeoKey, TYPE_SHORT, 1,
GTIFKeySet(gtif, GeogGeodeticDatumGeoKey,
TYPE_SHORT, 1,
GTIFKeySet(gtif,
GeogEllipsoidGeoKey, TYPE_SHORT, 1,
GTIFKeySet(gtif, GeogSemiMajorAxisGeoKey,
TYPE_DOUBLE, 1,
GTIFKeySet(gtif,
GeogInvFlatteningGeoKey, TYPE_DOUBLE, 1,
Linear_Meter);
KvUserDefined);
Ellipse_Everest_1830_1967_Definition);
(double)6377298.556);
(double)300.8017);
void WriteImage(TIFF *tif)
{
}
int i;
char
buffer[WIDTH];
memset(buffer,0,(size_t)WIDTH);
for
(i=0;i
if
(!TIFFWriteScanline(tif, buffer, i, 0))
TIFFError(
GeoTiff读取程序设计(初稿,需补充)
TIFF格式中Tag内容与HIPS格式内容对照表:
HPS
备注
TIFF
备注
Description
对文件的一般描述信
息,可以记录不大于
512字
节的说明信息,
比如文件的生成日
期,制作人等。
Artist
图像的作者
Tag =315
Type = ASCII
Copyright
Tag=33432
Type=SCII
DateTime
Tag=306
Type=ASCII
N=20
HostComputer
Tag=316
Type=ASCII
ImageDescription
Tag=270
Type=ASCII
Software
Tag=305
Type=ASCII
N=根据内容来定
Make
Tag=271
Type=ASCII
图像的版权信息
此图像生成的日期及时间
制作此图像的计算机及其操作系
统
生成图像的软件名称及版本号
Samples
文件的宽度
ImageWidth
Tag=256
Type=SHORTLONG
N=1
图像的宽度(像素为单位)
Lines
文件的高度
ImageLength
Tag=257
Type=SHORTLONG
N=1
图像的高度(像素为单位)
Bands
文件的波段数
这部分很值得探讨!!
DataType
数据类型,它
是一个
整型数,描述图像中
一个像素所用的数据
类型。1=字节型(8位),
2=短整型 (16位), 3=整
型 (32位), 4=单精度浮
点
(32位), 5=双精度浮
点 (64位), 12=无符号
短整数 (16位)
这部分很值得探讨!!
InterLeave
数据存储类型。共有三种,BSQ波段连续
存储;BIL行连续存
储;BIP像原连续存
储。标准格式
是BSQ
读取文件后自己设定(可以探讨)
ByteOrder
字节
序,表明本体文
件数据是用主机序还
是网络序存储的,标
准格式应为主机序。
FillOrder
Tag=266
Type=SHORT
N=1
Value=1从左到右
Value=2从右到左
每字节的数据,其位的排列方式
TIFF格式读取程序设计
TIFF图像
0 or 1
Value=0对黑白及灰度图像而言,0为白色
Value=1对黑白及灰度图像而言,0为黑色
BitPerSample=1
黑白图像
BitPerSample=4 16位灰度图像
BitPerSample=8 256位灰度图像
图像数据以R,G,B的方式存储
图像数据采用调色板索引
PhotometricInterpret
ati
2
3
多光谱图像
GeoTiff格式中相关问题探讨
主要是对HIPAS以下内容的考虑:
MapInformation
地理信息,该项用于描述图像的地理信息
ProjectInformation
投影信息,该项用于描述图像的投影信息
读取时:
1.本号的详细读取见文章所示,这里不再赘述;
2.坐标系类型判断,具体过程如下:
3.读取过程中需要读取的Tag如下:
ModelPixelScaleTag
ModelTiepointTag GeoKeyDirectoryTag CS
R -------- OR --------------->M--------- AND
----------> Earth
ModelTransformationTag
GeoDoubleParamsTag
GeoAsciiParamsTag
Tag的具体内容如下:
ModelPixelScaleTag = 33550 (SoftDesk)
ModelTransformationTag = 34264 (JPL Carto Group)
ModelTiepointTag = 33922
(Intergraph)
GeoKey DirectoryTag =
34735 (SPOT)
GeoDoubleParamsTag =
34736 (SPOT)
GeoAsciiParamsTag =
34737 (SPOT)
4.
地理坐标系中的需要读入的键如下,针对不同的情况需特殊考
虑(Section
中不同的代号代表不同的数值):
GeographicTypeGeoKey = 2048 * Section
6.3.2.1 Codes *
指定的地理坐标系类型,需指定其中几个可读取
(需讨论)
GeogCitationGeoKey = 2049 *
documentation *
GeogGeodeticDatumGeoKey = 2050 * Section
6.3.2.2 Codes *
指定的Geodetic
Datum类型,需指定其中几个可读取,其值(采用格林尼治
PM时)减
去2000即为Geographic的值
(需讨论)
GeogPrimeMeridianGeoKey = 2051 * Section
6.3.2.4 codes *
非DEM
DEM
RasterPixelIsArea = 1 RasterPixelIsArea = 2
GTCitationGeoKey(1026)
描述信息
GTRasterTypeGeoKey(1025)
ModelTypeProjected=1 ModelTypeGeographic = 2
ModelTypeGeocentric = 3
GTModelTypeGeoKey(1024)
GeoTiff图像
Header,确定GeoKey的个数
建议采用
PM_Greenwich =8901(需讨论)
GeogLinearUnitsGeoKey = 2052 * Section
6.3.1.3 Codes *
建议采用
Linear_Meter
=9001(需讨论)
GeogLinearUnitSizeGeoKey
= 2053 * meters *
GeogAngularUnitsGeoKey = 2054 * Section
6.3.1.4 Codes *
建议采用
Angular_Radian
=9101;Angular_Degree =9102(需讨论)
GeogAngularUnitSizeGeoKey = 2055 * radians
*
GeogEllipsoidGeoKey = 2056 *
Section 6.3.2.3 Codes *
指定椭球体类型,需指定其中几个可读取
(需讨论)
GeogSemiMajorAxisGeoKey = 2057 *
GeogLinearUnits *
GeogSemiMinorAxisGeoKey = 2058 *
GeogLinearUnits *
GeogInvFlatteningGeoKey = 2059 * ratio
*
GeogAzimuthUnitsGeoKey = 2060 *
Section 6.3.1.4 Codes *
建议采用
Angular_Radian =9101;Angular_Degree
=9102(需讨论)
GeogPrimeMeridianLongGeoKey
= 2061 * GeogAngularUnit *
5.投影坐标
系中的需要读入的键如下,针对不同的情况需特殊考虑,如不同
投影类型的定义,需要其中不同的参数,
具体请认真考虑(Section中不同的代
号代表不同的数值):
ProjectedCSTypeGeoKey = 3072 *
Section 6.3.3.1 codes *
指定投影坐标系类型,需指定其中几
个可读取
(需讨论),同时需要考虑目前常用的投
影,如上边Example中所示;
PCSCitationGeoKey = 3073 *
documentation *
ProjectionGeoKey
= 3074 * Section 6.3.3.2 codes*
指定投影类型,需指定
其中几个可读取
(需讨论),同时需要考虑目前常用的投影,如上边
Example中所示;<
br>
ProjCoordTransGeoKey = 3075
* Section 6.3.3.3 codes*
这部分的具体功能不是很清楚,需请卫征参与讨论;
ProjLinearUnitsGeoKey = 3076 * Section
6.3.1.3 codes*
建议采用
Linear_Meter
=9001(需讨论)
ProjLinearUnitSizeGeoKey
= 3077 * meters *
ProjStdParallel1GeoKey = 3078 *
GeogAngularUnit *
ProjStdParallel2GeoKey
= 3079 * GeogAngularUnit *
ProjNatOriginLongGeoKey = 3080 *
GeogAngularUnit *
ProjNatOriginLatGeoKey
= 3081 * GeogAngularUnit *
ProjFalseEastingGeoKey = 3082 *
ProjLinearUnits *
ProjFalseNorthingGeoKey
= 3083 * ProjLinearUnits *
ProjFalseOriginLongGeoKey = 3084 *
GeogAngularUnit *
ProjFalseOriginLatGeoKey
= 3085 * GeogAngularUnit *
ProjFalseOriginEastingGeoKey = 3086 *
ProjLinearUnits *
ProjFalseOriginNorthingGeoKey = 3087 *
ProjLinearUnits *
ProjCenterLongGeoKey
= 3088 * GeogAngularUnit *
ProjCenterLatGeoKey = 3089 *
GeogAngularUnit *
ProjCenterEastingGeoKey
= 3090 * ProjLinearUnits *
ProjCenterNorthingGeoKey = 3091 *
ProjLinearUnits *
ProjScaleAtNatOriginGeoKey = 3092 * ratio *
ProjScaleAtCenterGeoKey = 3093 *
ratio *
ProjAzimuthAngleGeoKey =
3094 * GeogAzimuthUnit *
ProjStraightVertPoleLongGeoKey = 3095 *
GeogAngularUnit *
5.垂直坐标系中的需要读入的键如下,针对不同的情况需特殊
考虑,
(Section中不同的代号代表不同的数值):
V
erticalCSTypeGeoKey = 4096 *
Section 6.3.4.1 codes*
指定垂直坐标系类型,需指定其中几个可读取
(需讨论);
VerticalCitationGeoKey = 4097 *
documentation *
VerticalDatumGeoKey
= 4098 * Section 6.3.4.2 codes *
这部分需详细讨论!!!!
VerticalUnitsGeoKey
= 4099 * Section 6.3.1.3 codes *
建议采用
Linear_Meter =9001(需讨论)