defaultm - Initialize or reset map projection structure

Syntax

mstruct = defaultm(projection)
mstruct = defaultm(mstruct)

Description

mstruct = defaultm(projection) initializes a map projection structure. projection is a string containing the name of a projection M-function.

mstruct = defaultm(mstruct) checks an existing map projection structure, sets empty properties, and adjusts dependent properties. The Origin, FLatLimit, FLonLimit, MapLatLimit, and MapLonLimit properties may be adjusted for compatibility with each other and with the MapProjection property and (in the case of UTM or UPS) the Zone property.

With defaultm, you can construct a map projection structure (mstruct) that contains all the information needed to project and unproject geographic coordinates using mfwdtran, minvtran, vfwdtran, or vintran without creating a map axes or making any use at all of MATLAB graphics. Relevant parameters in the mstruct include the projection name, angle units, zone (for UTM or UPS), origin, aspect, false easting, false northing, and (for conic projections) the standard parallel or parallels. In very rare cases you might also need to adjust the frame limit (FLatLimit and FLonLimit) or map limit (MapLatLimit and MapLonLimit) properties.

You should make exactly two calls to defaultm to set up your mstruct, using the following sequence:

  1. Construct a provisional version containing default values for the projection you've selected: mstruct = defaultm(projection);

  2. Assign appropriate values to mstruct.angleunits, mstruct.zone, mstruct.origin, etc.

  3. Set empty properties and adjust interdependent properties as needed to finalize your map projection structure: mstruct = defaultm(mstruct);

If you've set field prop1 of mstruct to value1, field prop2 to value2, and so forth, then the following sequence

mstruct = defaultm(projection);
mstruct.prop1 = value1;
mstruct.prop2 = value2;
...
mstruct = defaultm(mstruct);

produces exactly the same result as the following:

f = figure;
ax = axesm(projection, prop1, value1, prop2, value2, ...);
mstruct = getm(ax);
close(f)

but it avoids the use of graphics and is more efficient.

See the Mapping Toolbox User's Guide section on Working in UTM Without a Map Axes for information and an example showing the use of defaultm in combination with UTM.

Examples

Create an empty map projection structure for a Mercator projection:

mstruct = defaultm('mercator')

mstruct = 
     mapprojection: 'mercator'
              zone: []
        angleunits: 'degrees'
            aspect: 'normal'
      falseeasting: []
     falsenorthing: []
       fixedorient: []
             geoid: [1 0]
       maplatlimit: []
       maplonlimit: []
      mapparallels: 0
        nparallels: 1
            origin: []
       scalefactor: []
           trimlat: [-86 86]
           trimlon: [-180 180]
             frame: []
             ffill: 100
        fedgecolor: [0 0 0]
        ffacecolor: 'none'
         flatlimit: []
        flinewidth: 2
         flonlimit: []
              grid: []
         galtitude: Inf
            gcolor: [0 0 0]
        glinestyle: ':'
        glinewidth: 0.5000
    mlineexception: []
         mlinefill: 100
        mlinelimit: []
     mlinelocation: []
      mlinevisible: 'on'
    plineexception: []
         plinefill: 100
        plinelimit: []
     plinelocation: []
      plinevisible: 'on'
         fontangle: 'normal'
         fontcolor: [0 0 0]
          fontname: 'helvetica'
          fontsize: 9
         fontunits: 'points'
        fontweight: 'normal'
       labelformat: 'compass'
     labelrotation: 'off'
        labelunits: []
     meridianlabel: []
    mlabellocation: []
    mlabelparallel: []
       mlabelround: 0
     parallellabel: []
    plabellocation: []
    plabelmeridian: []
       plabelround: 0

Now change the map origin to [0 90 0], and fill in default projection parameters accordingly:

mstruct.origin = [0 90 0];
mstruct = defaultm(mstruct)

mstruct = 
     mapprojection: 'mercator'
              zone: []
        angleunits: 'degrees'
            aspect: 'normal'
      falseeasting: 0
     falsenorthing: 0
       fixedorient: []
             geoid: [1 0]
       maplatlimit: [-86 86]
       maplonlimit: [-90 270]
      mapparallels: 0
        nparallels: 1
            origin: [0 90 0]
       scalefactor: 1
           trimlat: [-86 86]
           trimlon: [-180 180]
             frame: 'off'
             ffill: 100
        fedgecolor: [0 0 0]
        ffacecolor: 'none'
         flatlimit: [-86 86]
        flinewidth: 2
         flonlimit: [-180 180]
              grid: 'off'
         galtitude: Inf
            gcolor: [0 0 0]
        glinestyle: ':'
        glinewidth: 0.5
    mlineexception: []
         mlinefill: 100
        mlinelimit: []
     mlinelocation: 30
      mlinevisible: 'on'
    plineexception: []
         plinefill: 100
        plinelimit: []
     plinelocation: 15
      plinevisible: 'on'
         fontangle: 'normal'
         fontcolor: [0 0 0]
          fontname: 'Helvetica'
          fontsize: 10
         fontunits: 'points'
        fontweight: 'normal'
       labelformat: 'compass'
     labelrotation: 'off'
        labelunits: 'degrees'
     meridianlabel: 'off'
    mlabellocation: 30
    mlabelparallel: 86
       mlabelround: 0
     parallellabel: 'off'
    plabellocation: 15
    plabelmeridian: -90
       plabelround: 0

See Also

axesm, gcm, mfwdtran, minvtran, setm

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS