Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

minvtran

Unproject features from map to geographic coordinates

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 any transformation functions, 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.0500
   38.9000  -77.0700
       NaN       NaN

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

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

ans =
   -0.0004    0.0002
   -0.0011    0.0010
    0.0001    0.0019
    0.0019    0.0002
    0.0001   -0.0019
    0.0003   -0.0016
    0.0003   -0.0003
   -0.0004    0.0002
   -0.0001    0.0002
   -0.0004    0.0002
       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 =
   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.0500
   38.9000  -77.0700
       NaN       NaN

Introduced before R2006a

Was this topic helpful?