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 map axes 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 map axes. 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 map axes 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

Compatibility Considerations

expand all

Not recommended starting in R2020b

Introduced before R2006a