geotiff2mstruct
Convert GeoTIFF information structure to map projection structure
Description
Examples
Get information about a GeoTIFF file by using the geotiffinfo
function. The file contains an image of Boston that is referenced to projected coordinates. The function stores the information in a structure array.
proj = geotiffinfo("boston.tif");
Convert the GeoTIFF information structure to a map projection structure by using the geotiff2mstruct
function.
mstruct = geotiff2mstruct(proj);
Read an overview image of Boston into the workspace as an array and a raster reference object. The overview image is referenced to geographic coordinates.
A = imread("boston_ovr.jpg"); R = worldfileread("boston_ovr.jgw","geographic",size(A));
Create an axesm
-based map using the projection stored in the map projection structure. Specify the geographic limits of the map using the limits stored in the reference object. Customize the map by adding labels and graticule lines.
figure latlim = R.LatitudeLimits; lonlim = R.LongitudeLimits; axesm(mstruct,MapLatlimit=latlim,MapLonlimit=lonlim, ... Grid="on",GColor=[0.9 0.9 0.9], ... ParallelLabel="on",PLabelLocation=0.025,PLabelRound=-2, ... PLineLocation=0.025, ... MeridianLabel="on",MLabelLocation=0.025,MLabelRound=-2, ... MLineLocation=0.025) tightmap
Display the overview image on the map. The geoshow
function projects the geographic coordinates using the map projection structure.
geoshow(A,R,DisplayType="image")
Get information about a GeoTIFF file by using the geotiffinfo
function. The function stores the information in a structure array.
proj = geotiffinfo("boston.tif");
Convert the GeoTIFF information structure to a map projection structure by using the geotiff2mstruct
function.
mstruct = geotiff2mstruct(proj);
Compare the projection stored in the GeoTIFF file to the map projection structure by unprojecting coordinates.
Specify xy-coordinates using the corner coordinates stored in the GeoTIFF file.
x = proj.CornerCoords.X; y = proj.CornerCoords.Y;
Get the length unit from the map projection structure. The length unit is survey feet.
unit = proj.UOMLength
unit = 'US survey foot'
Convert the corner coordinates from survey feet to meters. You must perform this step because the geotiff2mstruct
function reports linear values using meters.
xsf = unitsratio("meter","sf") * x; ysf = unitsratio("meter","sf") * y;
Unproject the coordinates using the GeoTIFF information structure and the map projection structure. Then, verify that the values are equal.
[latProj,lonProj] = projinv(proj,x,y); [latMstruct,lonMstruct] = projinv(mstruct,xsf,ysf); isequal(latProj,latMstruct)
ans = logical
1
isequal(lonProj,lonMstruct)
ans = logical
1
Input Arguments
GeoTIFF information structure, specified as a structure array returned by the
geotiffinfo
function. The
ModelType
field of the structure array must have a value of
'ModelTypeProjected'
.
Output Arguments
Map projection structure, returned as a structure array with fields identical to the
properties of an axesm
-based map. For more information about the
properties of axesm
-based maps, see axesm-Based Map Properties. The map projection structure returned by the
geotiff2mstruct
function reports linear values using
meters.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)