ds_tif

package
v0.0.0-...-7ce39f2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 12 Imported by: 0

README

tif

压缩算法

Decoding Encoding
None
LZW
Deflate
PackBits
JPEG
LERC

开发库

jblindsay/go-spatial
  • 在tiff格式之外还支持其他栅格数据文件
    • rst
    • dep
  • 不支持bigtiff
  • 会将ifds合并,排在后面的ifd优先级更高,这个机制应该是错的
google/tiff
  • 没有直接支持获取高程数据(灰度值),包括相关的lzw压缩算法等(在另外的库中,且lzw算法目前有问题,无法解析部分lzw压缩的tiff文件)
google/tiff/geotiff
  • BigTiff的文件头固定为8个字节,分别为49 49 2B 00 08 00 00 00。读取程序检测得到这8个字节即可判定文件为BigTiff格式。
  • BigTiff的文件尾固定为8个全零字节
geotiffjs/geotiff

这是一个js库

  • 可解析golang.org/x/image/tiff/lzw算法不支持的tiff文件
  • 压缩算法还支持 LERC 、JPEG
image-rs/image-tiff

这是一个rust库

// Tags (see p. 28-41 of the spec).
var tagMap = map[int]string{
	254: "NewSubFileType",
	256: "ImageWidth",
	257: "ImageLength",
	258: "BitsPerSample",
	259: "Compression",
	262: "PhotometricInterpretation",
	266: "FillOrder",
	269: "DocumentName",
	284: "PlanarConfiguration",
	270: "ImageDescription",
	271: "Make",
	272: "Model",
	273: "StripOffsets",
	274: "Orientation",
	277: "SamplesPerPixel",
	278: "RowsPerStrip",
	279: "StripByteCounts",
	280: "MinSampleValue",
	281: "MaxSampleValue",
	282: "XResolution",
	283: "YResolution",
	296: "ResolutionUnit",
	305: "Software",
	306: "DateTime",
	322: "TileWidth",
	323: "TileLength",
	324: "TileOffsets",
	325: "TileByteCounts",
	317: "Predictor",
	320: "ColorMap",
	338: "ExtraSamples",
	339: "SampleFormat",
	34735: "GeoKeyDirectoryTag",
	34736: "GeoDoubleParamsTag",
	34737: "GeoAsciiParamsTag",
	33550: "ModelPixelScaleTag",
	33922: "ModelTiepointTag",
	34264: "ModelTransformationTag",
	42112: "GDAL_METADATA",
	42113: "GDAL_NODATA",
	1024:  "GTModelTypeGeoKey",
	1025:  "GTRasterTypeGeoKey",
	1026:  "GTCitationGeoKey",
	2048:  "GeographicTypeGeoKey",
	2049:  "GeogCitationGeoKey",
	2050:  "GeogGeodeticDatumGeoKey",
	2051:  "GeogPrimeMeridianGeoKey",
	2061:  "GeogPrimeMeridianLongGeoKey",
	2052:  "GeogLinearUnitsGeoKey",
	2053:  "GeogLinearUnitSizeGeoKey",
	2054:  "GeogAngularUnitsGeoKey",
	2055:  "GeogAngularUnitSizeGeoKey",
	2056:  "GeogEllipsoidGeoKey",
	2057:  "GeogSemiMajorAxisGeoKey",
	2058:  "GeogSemiMinorAxisGeoKey",
	2059:  "GeogInvFlatteningGeoKey",
	2060:  "GeogAzimuthUnitsGeoKey",
	3072:  "ProjectedCSTypeGeoKey",
	3073:  "PCSCitationGeoKey",
	3074:  "ProjectionGeoKey",
	3075:  "ProjCoordTransGeoKey",
	3076:  "ProjLinearUnitsGeoKey",
	3077:  "ProjLinearUnitSizeGeoKey",
	3078:  "ProjStdParallel1GeoKey",
	3079:  "ProjStdParallel2GeoKey",
	3080:  "ProjNatOriginLongGeoKey",
	3081:  "ProjNatOriginLatGeoKey",
	3082:  "ProjFalseEastingGeoKey",
	3083:  "ProjFalseNorthingGeoKey",
	3084:  "ProjFalseOriginLongGeoKey",
	3085:  "ProjFalseOriginLatGeoKey",
	3086:  "ProjFalseOriginEastingGeoKey",
	3087:  "ProjFalseOriginNorthingGeoKey",
	3088:  "ProjCenterLongGeoKey",
	3089:  "ProjCenterLatGeoKey",
	3090:  "ProjCenterEastingGeoKey",
	3091:  "ProjFalseOriginNorthingGeoKey",
	3092:  "ProjScaleAtNatOriginGeoKey",
	3093:  "ProjScaleAtCenterGeoKey",
	3094:  "ProjAzimuthAngleGeoKey",
	3095:  "ProjStraightVertPoleLongGeoKey",
	4096:  "VerticalCSTypeGeoKey",
	4097:  "VerticalCitationGeoKey",
	4098:  "VerticalDatumGeoKey",
	4099:  "VerticalUnitsGeoKey",
	50844: "RPCCoefficientTag",
	34377: "Photoshop",
}

参考

Documentation

Index

Constants

View Source
const (
	PI_WhiteIsZero = 0
	PI_BlackIsZero = 1
	PI_RGB         = 2
	PI_Paletted    = 3
	PI_TransMask   = 4 // transparency mask
	PI_CMYK        = 5
	PI_YCbCr       = 6
	PI_CIELab      = 8
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DsTif

type DsTif struct {
	Tif       tiff.TIFF
	Data      []float64
	IFD_Index int
}

func ReadBytes

func ReadBytes(bs []byte) (*DsTif, error)

func ReadFile

func ReadFile(fileName string) (*DsTif, error)

func (DsTif) BBox

func (m DsTif) BBox() [4]float64

BBox

func (DsTif) GetAlt

func (m DsTif) GetAlt(column, row int) float64

GetAlt 获取行列坐标对应的高程数据

func (DsTif) GetAltByLonLat

func (m DsTif) GetAltByLonLat(lon, lat float64) float64

func (DsTif) GetColRow

func (m DsTif) GetColRow(lon, lat float64) [2]int

GetColRow 获取经纬度对应的行列坐标,这种算法不一定精确,不一定等间隔

func (DsTif) GetField

func (m DsTif) GetField(tagID uint16) tiff.Field

GetField 根据tagID获取对应field

func (DsTif) GetFirstInt

func (m DsTif) GetFirstInt(tagID uint16) uint

GetFirstInt

func (DsTif) GetFloat

func (m DsTif) GetFloat(tagID uint16) []float64

GetFloat

func (DsTif) GetInt

func (m DsTif) GetInt(tagID uint16) []uint

GetInt

func (DsTif) GetLonLat

func (m DsTif) GetLonLat(col, row int) [2]float64

GetLonLat 获取行列坐标对应的经纬度

func (DsTif) HasField

func (m DsTif) HasField(tagID uint16) bool

HasField 判断是否存在tagID对那个的field

func (DsTif) Height

func (m DsTif) Height() int

Height

func (DsTif) Origin

func (m DsTif) Origin() []float64

Origin 获取坐标原点,通常是经纬度坐标原点

func (DsTif) Scale

func (m DsTif) Scale() []float64

栅格坐标和模型坐标的比例

func (DsTif) Transform

func (m DsTif) Transform() []float64

栅格坐标到模型坐标的变换矩阵,这个值很多时候是空值

func (DsTif) Width

func (m DsTif) Width() int

Width

Directories

Path Synopsis
Package lzw implements the Lempel-Ziv-Welch compressed data format, described in T. A. Welch, “A Technique for High-Performance Data Compression”, Computer, 17(6) (June 1984), pp 8-19.
Package lzw implements the Lempel-Ziv-Welch compressed data format, described in T. A. Welch, “A Technique for High-Performance Data Compression”, Computer, 17(6) (June 1984), pp 8-19.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL