geotiffinterp

バージョン 1.1.0.0 (379 KB) 作成者: Chad Greene
Fast interpolation for georeferenced TIFF raster data.
ダウンロード: 1.8K
更新 2014/9/22

ライセンスの表示

Getting data out of a GeoTIFF DEM is not straightforward in Matlab. You may have a georeferenced .tif data set of magnetic anomalies and you want to extract those anomalies along some path you walked with your GPS in hand. With lat,lon arrays describing your path, this function allows you to simply type
geotiffinterp('mag.tif',lat,lon)

to get the data you seek.

This function interpolates values of a georeferenced tiff file, given lat/lon coordinates or map x/y locations corresponding to the map projection associated with the tiff file. This function is fast because even if the GeoTIFF file is quite large, only a region of the image large enough to perform interpolation is loaded. This function was designed to easily probe GeoTIFF datasets such as digital elevation maps (DEMs) or other geospatial data arrays. It can be used to interpolate values from a georeferenced satellite image, but if you're working with images, other functions such as geotiffreadregion may be more useful.

Syntax
Ai = geotiffinterp(filename,lati,loni)
Ai = geotiffinterp(filename,xi,yi)
Ai = geotiffinterp(...,InterpolationMethod)
Ai = geotiffinterp(...,'nanval',NanValue)
Ai = geotiffinterp(...,'frame',FrameNumber)
Ai = geotiffinterp(...,'show')

Description
Ai = geotiffinterp(filename,lati,loni) returns interpolated values of a tiff image at georeferenced locations given by lati and loni.

Ai = geotiffinterp(filename,xi,yi) returns interpolated values a tiff image where xi and yi are units of distance (usually feet or meters) in projected map coordinates described by the projection metadata in the tiff file. The way xi and yi are interpreted: if no value in xi has an absolute value exceeding 90 and no value in yi has an absolute value exceeding 360, then geographic coordinates of degrees are assumed. Otherwise, the first two inputs after filename are assumed to be map x/y coordinates.

Ai = geotiffinterp(...,InterpolationMethod) specifies an interpolation method as 'nearest', 'linear', 'spline', or 'cubic'. Default interpolation method is linear.

Ai = geotiffinterp(...,'nanval',NanValue) sets a specified value in the tiff to NaN before interpolation. In GeoTIFF format, undefined values are often set to 32767 because the tiff format only stores integers. By default, geotiffinterp sets replaces all values of 32767 to NaN before interpolation. To prevent geotiffinterp from doing this, declare 'nanval',NaN. To replace some other value, say 9999, to NaN before interpolation, use 'nanval',9999.

Ai = geotiffinterp(...,'frame',FrameNumber) specifies a frame number to interpolate, if the GeoTIFF contains multiple frames. Currently, FrameNumber can only have a single scalar value, so you'll have to loop geotiffinterp to probe multiple frames. If the tiff file contains multiple frames and you do not specify which one you're interested in, geotiffinterp will only interpolate the first frame. As this applies to georeferenced image tiffs with three slices corresponding to red, green, and blue, if you want all three colors you will have to run geotiffinterp once for each color.

Ai = geotiffinterp(...,'show') plots the subsection of the tiff that is loaded by geotiffinterp in grayscale and overlays markers showing interpolation locations.

引用

Chad Greene (2024). geotiffinterp (https://www.mathworks.com/matlabcentral/fileexchange/47899-geotiffinterp), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2012b
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

geotiffinterp_documentation/html/

バージョン 公開済み リリース ノート
1.1.0.0

Linked to Kelly Kearney's interpshapefile.

1.0.0.0