MATLAB Examples

Working in UTM Without a Map Axes

You can set up UTM to calculate coordinates without generating a map display, using the defaultm function. The utmzone and utmgeoid functions help you select a zone and an appropriate ellipsoid. In this example, you generate UTM coordinate data for a location in New York City, using that point to define the projection itself.

Define a location in New York City.

p1 = [40.7, -74.0];

Obtain the UTM zone for this point.

z1 = utmzone(p1)
z1 =

    '18T'

Obtain the suggested ellipsoid vector and name for this zone.

[ellipsoid,estr] = utmgeoid(z1)
ellipsoid =

   1.0e+06 *

    6.3782    0.0000


estr =

    'clarke66'

Set up the UTM coordinate system based on this information.

utmstruct = defaultm('utm');
utmstruct.zone = '18T';
utmstruct.geoid = ellipsoid;
utmstruct = defaultm(utmstruct)
utmstruct = 

  struct with fields:

     mapprojection: 'utm'
              zone: '18T'
        angleunits: 'degrees'
            aspect: 'normal'
     falsenorthing: 0
      falseeasting: 500000
       fixedorient: []
             geoid: [6.3782e+06 0.0823]
       maplatlimit: [40 48]
       maplonlimit: [-78 -72]
      mapparallels: []
        nparallels: 0
            origin: [0 -75 0]
       scalefactor: 0.9996
           trimlat: [-80 84]
           trimlon: [-180 180]
             frame: 'off'
             ffill: 100
        fedgecolor: [0.1500 0.1500 0.1500]
        ffacecolor: 'none'
         flatlimit: [40 48]
        flinewidth: 2
         flonlimit: [-3 3]
              grid: 'off'
         galtitude: Inf
            gcolor: [0.1500 0.1500 0.1500]
        glinestyle: ':'
        glinewidth: 0.5000
    mlineexception: []
         mlinefill: 100
        mlinelimit: []
     mlinelocation: 1
      mlinevisible: 'on'
    plineexception: []
         plinefill: 100
        plinelimit: []
     plinelocation: 1
      plinevisible: 'on'
         fontangle: 'normal'
         fontcolor: [0.1500 0.1500 0.1500]
          fontname: 'Helvetica'
          fontsize: 10
         fontunits: 'points'
        fontweight: 'normal'
       labelformat: 'compass'
     labelrotation: 'off'
        labelunits: 'degrees'
     meridianlabel: 'off'
    mlabellocation: 1
    mlabelparallel: 48
       mlabelround: 0
     parallellabel: 'off'
    plabellocation: 1
    plabelmeridian: -78
       plabelround: 0

Calculate the grid coordinates, without a map display.

[x,y] = mfwdtran(utmstruct,p1(1),p1(2))
x =

   5.8448e+05


y =

   4.5057e+06

Compute the zone limits (latitude and longitude limits) for the zone name returned previously, using the utmzone function.

utmzone('18T')
ans =

    40    48   -78   -72

Therefore, you can call utmzone recursively to obtain the limits of the UTM zone within which a point location falls.

[zonelats,zonelons] = utmzone(utmzone(40.7, -74.0))
zonelats =

    40    48


zonelons =

   -78   -72