主要内容

本页采用了机器翻译。点击此处可查看英文原文。

更改投影和投影参数

地图坐标轴对象使用投影坐标参考系 (CRS) 将地理(纬度-经度)坐标转换为投影 (xy) 坐标。投影坐标系由地理坐标系、投影方法和投影参数组成。

您可以通过更改投影坐标系 (CRS) 或投影参数,来更改地图坐标系对象的地图投影。当您更改投影坐标参考系统 (CRS) 或投影参数时,地图坐标轴会自动对已绘制的数据进行重新投影。

更改投影 CRS

通过更改投影坐标系 (CRS),来更改地图坐标系对象的地图投影。

使用默认地图坐标轴显示世界陆地面积的 shapefile。

figure
newmap

land = readgeotable("landareas.shp");
geoplot(land)

Figure contains an axes object with type mapaxes. The mapaxes object contains an object of type polygon.

查看存储在地图坐标轴中的投影 CRS 的相关信息。默认情况下,地图坐标轴采用“等距地球”投影法。这种投影法能保持面积不变。

mx1 = gca;
mx1.ProjectedCRS
ans = 
  projcrs with properties:

                    Name: "WGS 84 / Equal Earth Greenwich"
           GeographicCRS: [1×1 geocrs]
        ProjectionMethod: "Equal Earth"
              LengthUnit: "meter"
    ProjectionParameters: [1×1 map.crs.ProjectionParameters]

创建一个使用等距圆柱投影法的 CRS 对象。这种投影法能保持距离。

p = projcrs(4087)
p = 
  projcrs with properties:

                    Name: "WGS 84 / World Equidistant Cylindrical"
           GeographicCRS: [1×1 geocrs]
        ProjectionMethod: "Equidistant Cylindrical"
              LengthUnit: "meter"
    ProjectionParameters: [1×1 map.crs.ProjectionParameters]

更改地图坐标区的投影坐标系 (CRS)。当您更改投影坐标系 (CRS) 时,MATLAB® 会自动更新地图并重新投影绘制的数据。

mx1.ProjectedCRS = p;

Figure contains an axes object with type mapaxes. The mapaxes object contains an object of type polygon.

更改投影参数

通过修改存储在“投影坐标系” (CRS) 中的投影参数,来更改地图坐标系对象的地图投影。

创建一个使用博内投影法的 CRS 对象。

p = projcrs(54024,Authority="ESRI")
p = 
  projcrs with properties:

                    Name: "World_Bonne"
           GeographicCRS: [1×1 geocrs]
        ProjectionMethod: "Bonne"
              LengthUnit: "meter"
    ProjectionParameters: [1×1 map.crs.ProjectionParameters]

在采用投影坐标系 (CRS) 的地图坐标系对象中显示世界陆地区域的图像。

figure
newmap(p)

[im,imR] = readgeoraster("bluegreen-world.tif");
geoimage(im,imR)

Figure contains an axes object with type mapaxes. The mapaxes object contains an object of type rasterimage.

查看存储在投影坐标系中的投影参数。有关投影参数的信息,请参阅 projcrs 参考页面的 ProjectionParameters 属性说明。

mx2 = gca;
mx2.ProjectedCRS.ProjectionParameters
ans = 
  ProjectionParameters object with parameters:

     LatitudeOfNaturalOrigin: 60
    LongitudeOfNaturalOrigin: 0
                FalseEasting: 0
               FalseNorthing: 0

将“自然来源”的纬度更改为 90。有效的参数值取决于参数本身以及地图投影方法。当您更改投影参数时,MATLAB 会自动更新地图并对绘制的数据进行重新投影。

mx2.ProjectedCRS.ProjectionParameters.LatitudeOfNaturalOrigin = 90;

Figure contains an axes object with type mapaxes. The mapaxes object contains an object of type rasterimage.

创建几幅采用邦纳投影法且采用拼图式图表布局的世界地图。每张地图应使用不同的自然纬度。

figure
tiledlayout(2,2,Padding="tight");

for latNaturalOrigin = [1 10 60 90]
    nexttile
    newmap(p)
    geoimage(im,imR)

    mx = gca;
    mx.ProjectedCRS.ProjectionParameters.LatitudeOfNaturalOrigin = latNaturalOrigin;

    mx.FontColor = "none";
    title("Latitude of Natural Origin: " + latNaturalOrigin,ColorMode="auto")
end

Figure contains 4 axes objects. Mapaxes object 1 contains an object of type rasterimage. Mapaxes object 2 contains an object of type rasterimage. Mapaxes object 3 contains an object of type rasterimage. Mapaxes object 4 contains an object of type rasterimage.

另请参阅

函数

对象

属性

主题