Get geographic location data for the District of
Columbia.
dc = shaperead('usastatelo', 'UseGeoCoords', true,...
'Selector',{@(name) strcmpi(name,'District of Columbia'),...
'Name'});
lat = [dc.Lat]';
lon = [dc.Lon]';
[lat lon]
ans =
38.9000 -77.0700
38.9500 -77.1200
39.0000 -77.0300
38.9000 -76.9000
38.7800 -77.0300
38.8000 -77.0200
38.8700 -77.0200
38.9000 -77.0700
38.9000 -77.0700
NaN NaN
Obtain the UTM zone for this point.
dczone = utmzone(mean(lat,'omitnan'),mean(lon,'omitnan'))
dczone =
'18S'
Set up the UTM coordinate system based on this
information.
utmstruct = defaultm('utm');
utmstruct.zone = dczone;
utmstruct.geoid = wgs84Ellipsoid;
utmstruct = defaultm(utmstruct);
Project the District of Columbia data from geographic
coordinates into map coordinates for UTM zone
18S.
[x,y] = mfwdtran(utmstruct,lat,lon)
x =
1.0e+05 *
3.2049
3.1629
3.2421
3.3524
3.2367
3.2459
3.2476
3.2049
3.2049
NaN
y =
1.0e+06 *
4.3077
4.3134
4.3187
4.3074
4.2943
4.2965
4.3043
4.3077
4.3077
NaN