defaultm
Create or reset map projection structure
Description
resets the map projection structure mstruct
= defaultm(mstructIn
)mstructIn
by updating empty and
dependent fields. The function updates the origin
,
flatlimit
, flonlimit
,
maplatlimit
, and maplonlimit
fields so they are
compatible with each other and with the mapprojection
field. When the
structure represents a UTM or UPS coordinate system, the function also updates the
zone
field.
Note
To set up a map projection structure, you must use the defaultm
function twice. These steps show how to set up a map projection structure.
Create a map projection structure with default values by using the syntax
defaultm(projid)
.Customize the map projection structure by specifying values for fields such as
origin
,maplatlim
, andmaplonlim
.Update empty and dependent fields of the map projection structure by using the syntax
defaultm(mstructIn)
.
Examples
Input Arguments
Output Arguments
Tips
By default, the angle-valued fields of map projection structures are in degrees. If you must work in radians, update the
angleunits
field of the structure and then reset the structure. This code shows how to update your map projection structure to use radians.mstruct = defaultm("mercator"); mstruct.angleunits = "radians"; mstruct = defaultm(mstruct);
Once you update a structure to use radians, you must use radians when you change angle-valued fields such as
origin
,parallels
,maplatlimit
, andmaplonlimit
.You can get a map projection structure from an
axesm
-based map by using thegcm
function. This code shows how to create the same map projection structure by using thedefaultm
function as from anaxesm
-based map.% Set longitude limits and define reference ellipsoid lonlim = [-150 -30]; ref = referenceEllipsoid("grs80","kilometers"); % Create map projection structure using defaultm mstruct1 = defaultm("sinusoid"); mstruct1.maplonlimit = lonlim; mstruct1.geoid = ref; mstruct1 = defaultm(mstruct1); % Create map projection structure from axesm-based map abm = axesm("sinusoid","maplonlimit",lonlim,"geoid",ref); mstruct2 = gcm(abm); f = gcf; close(f) % Compare map structures isequal(mstruct1,mstruct2)