Main Content

mfwdtran

(Removed) Project geographic features to map coordinates

The mfwdtran function has been removed. In most cases, use the projfwd function instead. If the mapprojection property of the current axesm-based map or specified map projection structure is 'globe', then use the geodetic2ecef function instead. For more information, see Version History.

Syntax

[x,y] = mfwdtran(lat,lon)
[x,y,z] = mfwdtran(lat,lon,alt)
[...] = mfwdtran(mstruct,...)

Description

[x,y] = mfwdtran(lat,lon) applies the forward transformation defined by the map projection in the current axesm-based map. You can use this function to convert point locations and line and polygon vertices given in latitudes and longitudes to a planar, projected map coordinate system.

[x,y,z] = mfwdtran(lat,lon,alt) applies the forward projection to 3-D input, resulting in 3-D output. If the input alt is empty or omitted, then alt = 0 is assumed.

[...] = mfwdtran(mstruct,...) requires a valid map projection structure as the first argument. In this case, no axesm-based map is needed.

Examples

collapse all

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

Version History

Introduced before R2006a

expand all