Main Content

minvtran

(To be removed) Unproject features from map to geographic coordinates

minvtran will be removed in a future release. In most cases, use the projinv function instead. If the mapprojection field of the current axesm-based map or specified map projection structure is 'globe', then use the ecef2geodetic function instead. For more information, see Compatibility Considerations.

Syntax

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

Description

[lat,lon] = minvtran(x,y) applies the inverse transformation defined by the map projection in the current axesm-based map. Using minvtran, you can convert point locations and line and polygon vertices in a planar, projected map coordinate system to latitudes and longitudes.

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

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

Examples

Before using minvtran, it is necessary to create a map projection structure. You can do this with axesm or the defaultm function:

mstruct = defaultm('mercator');
mstruct.origin = [38.89 -77.04 0];
mstruct = defaultm(mstruct);

The following latitude and longitude data for the District of Columbia is obtained from the usastatelo shapefile:

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

This data can be projected into Cartesian coordinates of the Mercator projection using the projfwd function:

[x,y] = projfwd(mstruct,lat,lon);
[x y]
ans =

   -0.0004    0.5745
   -0.0011    0.5753
    0.0001    0.5762
    0.0019    0.5745
    0.0001    0.5724
    0.0003    0.5727
    0.0003    0.5739
   -0.0004    0.5745
   -0.0004    0.5745
       NaN       NaN

To transform the projected x-y data back into the unprojected geographic system, use the minvtran function:

[lat2,lon2] = minvtran(mstruct,x,y);
[lat2 lon2]
ans =

   70.1302  -77.0987
   70.1729  -77.1969
   70.2157  -77.0204
   70.1300  -76.7659
   70.0276  -77.0205
   70.0447  -77.0010
   70.1046  -77.0009
   70.1302  -77.0987
   70.1302  -77.0987
       NaN       NaN

Version History

Introduced before R2006a

expand all

R2023a: Warns

The minvtran function issues a warning that it will be removed in a future release. In most cases, use the projinv function instead. If the mapprojection field of the current axesm-based map or specified map projection structure is 'globe', then use the ecef2geodetic function instead.

This table shows some typical uses of the minvtran function and how to update your code to use the projinv function instead.

Will Be RemovedRecommended
[lat,lon,alt] = minvtran(x,y);
mstruct = gcm;
[lat,lon] = projinv(mstruct,x,y);
[lat,lon,alt] = minvtran(mstruct,x,y);
[lat,lon] = projinv(mstruct,x,y);

This table shows some typical uses of the minvtran function and how to update your code to use the ecef2geodetic function instead.

Will Be RemovedRecommended
[lat,lon,alt] = minvtran(x,y,z);
mstruct = gcm;
[lat,lon,alt] = ecef2geodetic(x,y,z,mstruct.geoid);
[lat,lon,alt] = minvtran(mstruct,x,y,z);
[lat,lon,alt] = ecef2geodetic(x,y,z,mstruct.geoid);

If the value of the mapprojection field of the map projection structure is listed in this table, then you must specify all linear units in meters, including coordinates and map projection structure fields. After you have projected the coordinates, you can convert them to other units using the unitsratio function.

ValueProjection Name

'tranmerc'

Transverse Mercator

'mercator'

Mercator

'lambertstd'

Lambert Conformal Conic

'eqaazim'

Lambert Azimuthal Equal Area

'eqaconicstd'

Albers Equal-Area Conic

'eqdazim'

Azimuthal Equidistant

'eqdconicstd'

Equidistant Conic

'ups'

Polar Stereographic

'stereo'

Oblique Stereographic

'eqdcylin'

Equirectangular

'cassinistd'

Cassini-Soldner

'gnomonic'

Gnomonic

'miller'

Miller Cylindrical

'ortho'

Orthographic

'polyconstd'

Polyconic

'robinson'

Robinson

'sinusoid'

Sinusoidal

'vgrint1'

Van der Grinten

'eqacylin'

Equal Area Cylindrical