MATLAB 帮助中心
本页采用了机器翻译。点击此处可查看英文原文。
栅格元素的地理坐标
自 R2021a 起
[lat,lon] = geographicGrid(R)
[lat,lon] = geographicGrid(R,gridOption)
[lat,lon] = geographicGrid(R) 将栅格元素的地理坐标返回为二维数组 lat 和 lon。栅格元素 (i,j) 的坐标为 (lat(i,j),lon(i,j))。
lat
lon
R
(i,j)
(lat(i,j),lon(i,j))
示例
[lat,lon] = geographicGrid(R,gridOption),其中 gridOption 是 'gridvectors',返回 lat 和 lon 作为向量。栅格元素 (i,j) 的坐标为 (lat(i),lon(j))。gridOption 的默认值为 'fullgrid',其返回值为二维数组 lat 和 lon。
gridOption
'gridvectors'
(lat(i),lon(j))
'fullgrid'
全部折叠
导入科罗拉多州南博尔德峰周边区域的高程数据 [1],作为数组和地理发布参考对象。获取数组中每个元素的坐标。
[Z,R] = readgeoraster('n39_w106_3arc_v2.dt1'); [lat,lon] = geographicGrid(R);
创建一张地图,其纬度和经度范围与数据范围相匹配。使用适当的颜色图显示数据。
usamap(R.LatitudeLimits,R.LongitudeLimits) surfm(lat,lon,Z) demcmap(Z)
[1] The elevation data used in this example is courtesy of the U.S. Geological Survey.
创建一个地理单元参考对象,用于表示一个 3×4 的栅格,其纬度值范围为 [0, 30] 度,经度值范围为 [-20, 20] 度。获取栅格元素的坐标,并将其作为行向量返回。
R = georefcells([0 30],[-20 20],[3 4]); [lat,lon] = geographicGrid(R,'gridvectors')
lat = 1×3 5 15 25
lon = 1×4 -15 -5 5 15
若未将第二个参数指定为 'gridvectors',则 geographicGrid 函数默认返回二维数组。
geographicGrid
[latFull,lonFull] = geographicGrid(R)
latFull = 3×4 5 5 5 5 15 15 15 15 25 25 25 25
lonFull = 3×4 -15 -5 5 15 -15 -5 5 15 -15 -5 5 15
GeographicCellsReference
GeographicPostingsReference
空间参考,指定为 GeographicCellsReference 或 GeographicPostingsReference 对象。
若 R 是 GeographicCellsReference 对象,则 lat 和 lon 均为单元中心。如果 R 是 GeographicPostingsReference 对象,则 lat 和 lon 是发布点。
网格选项,指定为以下值之一:
'fullgrid' - 将 lat 和 lon 作为二维数组返回,其中 lat 的每列相同,lon 的每行相同。这是默认行为。
'gridvectors' - 将 lat 和 lon 作为行向量返回。当您希望减少内存使用且无需二维数组时,请使用此选项,例如使用 surfm 函数绘制大型数据集时。
surfm
此表显示了 'fullgrid' 与 'gridvectors' 之间的差异。
R = georefcells([0 30],[-20 20],[3 4]); [lat,lon] = geographicGrid(R)
lat = 5 5 5 5 15 15 15 15 25 25 25 25 lon = -15 -5 5 15 -15 -5 5 15 -15 -5 5 15
lat = 5 15 25 lon = -15 -5 5 15
数据类型: char | string
char
string
纬度,以二维数组或行向量形式返回。默认情况下,lat 是二维数组。要将 lat 作为行向量返回,请将 gridOption 指定为 'gridvectors'。
默认情况下,当 gridOption 为 'fullgrid' 时,lat 和 lon 的大小各等于 R 的 RasterSize 属性。当 gridOption 等于 'gridvectors' 时,lat 和 lon 的长度分别等于 R 的 RasterSize 属性的第一个和第二个元素。
RasterSize
经度,以二维数组或行向量形式返回。默认情况下,lon 是二维数组。要将 lon 作为行向量返回,请将 gridOption 指定为 'gridvectors'。
在 R2021a 中推出
ndgrid
meshgrid
intrinsicToGeographic
worldGrid
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 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处