geotiff2mstruct
将 GeoTIFF 信息结构转换为地图投影结构
说明
示例
使用 geotiffinfo 函数获取 GeoTIFF 文件的相关信息。该文件包含一张波士顿的图像,该图像以投影坐标为参考。该函数将信息存储在一个结构体数组中。
proj = geotiffinfo("boston.tif");使用 geotiff2mstruct 函数将 GeoTIFF 信息结构转换为地图投影结构。
mstruct = geotiff2mstruct(proj);
将波士顿的概览图像作为数组和栅格引用对象导入工作区。概览图像以地理坐标为参考。
A = imread("boston_ovr.jpg"); R = worldfileread("boston_ovr.jgw","geographic",size(A));
使用存储在地图投影结构中的投影,创建一个基于 axesm 的地图。使用参考对象中存储的边界,指定地图的地理边界。通过添加图例和经纬度网格线自定义地图。
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
在地图上显示概览图。geoshow 函数使用地图投影结构对地理坐标进行投影。
geoshow(A,R,DisplayType="image")
使用 geotiffinfo 函数获取 GeoTIFF 文件的相关信息。该函数将信息存储在一个结构体数组中。
proj = geotiffinfo("boston.tif");使用 geotiff2mstruct 函数将 GeoTIFF 信息结构转换为地图投影结构。
mstruct = geotiff2mstruct(proj);
通过反投影坐标,将 GeoTIFF 文件中存储的投影与地图投影结构进行比较。
使用 GeoTIFF 文件中存储的角点坐标指定 xy 坐标。
x = proj.CornerCoords.X; y = proj.CornerCoords.Y;
从地图投影结构中获取长度单位。长度单位为测绘英尺。
unit = proj.UOMLength
unit = 'US survey foot'
将拐点坐标从测量英尺转换为米。您必须执行此步骤,因为 geotiff2mstruct 函数报告的线性值单位为米。
xsf = unitsratio("meter","sf") * x; ysf = unitsratio("meter","sf") * y;
利用 GeoTIFF 信息结构和地图投影结构对坐标进行反投影。然后,验证这些值是否相等。
[latProj,lonProj] = projinv(proj,x,y); [latMstruct,lonMstruct] = projinv(mstruct,xsf,ysf); isequal(latProj,latMstruct)
ans = logical
1
isequal(lonProj,lonMstruct)
ans = logical
1
输入参数
GeoTIFF 信息结构,指定为由 geotiffinfo 函数返回的结构数组。结构数组中的 ModelType 字段的值必须为 'ModelTypeProjected'。
输出参量
地图投影结构,以结构数组的形式返回,其字段与基于 axesm 的地图的属性完全一致。有关基于 axesm 的映射的更多属性信息,请参阅 axesm-Based Map Properties。geotiff2mstruct 函数返回的地图投影结构以米为单位报告线性值。
版本历史记录
在 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)