Main Content

Change Projection and Projection Parameters

Map axes objects use projected coordinate reference systems (CRSs) to transform geographic (latitude-longitude) coordinates to projected (xy) coordinates. Projected CRSs consist of a geographic CRS, a projection method, and projection parameters.

You can change the map projection for a map axes object by changing the projected CRS or by changing the projection parameters. Map axes automatically reproject plotted data when you change the projected CRS or projection parameters.

Change Projected CRS

Change the map projection for a map axes object by changing the projected CRS.

Plot world land areas using the default map axes.

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.

View information about the projected CRS stored in the map axes. By default, map axes use the Equal Earth projection method. This projection method preserves area.

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

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

Create a projected CRS object that uses an Equidistant Cylindrical projection method. This projection method preserves distances.

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

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

Change the projected CRS of the map axes. When you change the projected CRS, MATLAB® automatically updates the map and reprojects the plotted data.

mx1.ProjectedCRS = p;

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

Change Projection Parameters

Change the map projection for a map axes object by changing the projected parameters stored in the projected CRS.

Create a projected CRS object that uses the Bonne projection method.

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

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

Plot the same world land areas in a map axes object that uses the projected CRS.

figure
newmap(p)
geoplot(land)

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

View the projection parameters stored in the projected CRS. For more information about projection parameters, see the ProjectionParameters property description on the projcrs reference page.

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

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

Change the latitude of natural origin to 90. Valid parameter values depend on the parameter and on the map projection method. When you change a projection parameter, MATLAB automatically updates the map and reprojects the plotted data.

mx2.ProjectedCRS.ProjectionParameters.LatitudeOfNaturalOrigin = 90;

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

Create several world maps that use the Bonne projection method in a tiled chart layout. Use a different latitude of natural origin for each map.

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

for latNaturalOrigin = [1 10 60 90]
    nexttile
    newmap(p)
    geoplot(land)

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

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

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

See Also

Functions

Objects

Properties

Related Topics