Mapping Toolbox | ![]() ![]() |
Transform unprojected Greenwich data to a projected Cartesian coordinate system
Syntax
[x,y] = mfwdtran(lat,lon) [x,y,z] = mfwdtran(lat,lon,alt) [x,y,z,struct] = mfwdtran(lat,lon,alt,object) [...] = mfwdtran(mstruct,...)
Description
[x,y] = mfwdtran(lat,lon) transforms unprojected Greenwich data to the projected Cartesian coordinate frame using the map projection defined for the current axes. No clipping or trimming of data is performed with this calling form.
[x,y,z] = mfwdtran(lat,lon,alt) transforms the three-dimensional data to the projected Cartesian coordinate frame using the map projection defined for the current axes. If alt = []
or alt
is omitted, the default alt = 0
is used.
[x,y,z,struct] = mfwdtran(lat,lon,alt,object
) clips and trims the data during the transformation process. Allowable object
strings are 'surface'
, 'line'
, 'patch'
, 'light'
, 'text'
, and 'none'
. 'none'
will result in no clipping or trimming of the input data. The output struct
is a structure containing information about the clips and trims associated with the transformed object. This structure is also found in the displayed object's UserData
property.
[...] = mfwdtran(mstruct,...) requires a valid map projection structure as the first argument. This structure is used to define the map projection calculations performed. No map axes need be displayed when using this
calling form.
Examples
The following latitude and longitude data for the District of Columbia is obtained from the usalo
workspace:
load usalo lat = state(51).lat; lon = state(51).long; [lat lon] ans = 38.9000 -77.0700 38.9000 -77.0500 38.9000 -77.0700 38.8700 -77.0200 38.8000 -77.0200 38.7800 -77.0300 38.9000 -76.9000 39.0000 -77.0300 38.9500 -77.1200 38.9000 -77.0700
Before projecting the data, it is necessary to define projection parameters. This can be done with the axesm
command, or with the defaultm
command:
Now that the projection parameters have been set, transform the District of Columbia data into the Cartesian frame using the Mercator projection:
[x,y] = mfwdtran(mstruct,lat,lon); [x y] ans = -0.0004 0.0002 -0.0001 0.0002 -0.0004 0.0002 0.0003 -0.0003 0.0003 -0.0016 0.0001 -0.0019 0.0019 0.0002 0.0001 0.0019 -0.0011 0.0010 -0.0004 0.0002
See Also
defaultm |
Initialize a default map data structure |
gcm |
Get current map data structure |
minvtran |
Map inverse transformation |
vfwdtran |
Vector forward transformation |
vinvtran |
Vector inverse transformation |
![]() | meshm | minaxis | ![]() |