Main Content

Work in UTM Without a Displayed Map

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. Obtain the UTM zone for this point.

lat = 40.7;
lon = -74.0;
z = utmzone(lat,lon)
z = 
'18T'

Get the suggested ellipsoid vector and name for this zone.

[ellipsoid,estr] = utmgeoid(z)
ellipsoid = 1×2
106 ×

    6.3782    0.0000

estr = 
'clarke66'

Set up the UTM coordinate system based on this information.

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

Transform the coordinates, without a map display.

[x,y] = projfwd(utmstruct,lat,lon)
x = 
5.8448e+05
y = 
4.5057e+06

Compute the zone limits (latitude and longitude limits) for a specified zone by using the utmzone function. You can also call utmzone recursively to obtain the limits of the UTM zone within which a point location falls.

utmzone('18T')
ans = 1×4

    40    48   -78   -72

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

    40    48

zonelons = 1×2

   -78   -72

Alternatively, set up a UTM coordinate system using a projcrs object. To create the object, specify an EPSG code. For information about EPSG codes, see the EPSG registry. Verify that the projcrs object has the correct name and ellipsoid. Then, transform the coordinates.

p = projcrs(26718);
p.Name
ans = 
"NAD27 / UTM zone 18N"
p.GeographicCRS.Spheroid.Name
ans = 
'Clarke 1866'
[xp,yp] = projfwd(p,lat,lon)
xp = 
5.8448e+05
yp = 
4.5057e+06

See Also

| | | |