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.

projinv

Inverse map projection using PROJ.4 map projection library

Syntax

  • [lat,lon] = projinv(proj,x,y)
    example

Description

example

[lat,lon] = projinv(proj,x,y) returns the latitude and longitude values from the inverse projection transformation. proj is a structure defining the map projection. proj can be a map projection mstruct or a GeoTIFF info structure. x and y are x-y map coordinate arrays. For a complete list of GeoTIFF info and map projection structures that you can use with projinv, see the reference page for projlist.

Examples

collapse all

Import the Boston roads from the shapefile and obtain the projection structure from the 'boston.tif' orthophoto.

roads = shaperead('boston_roads.shp');
proj = geotiffinfo('boston.tif');

Convert the road coordinates to the projection's length unit. In this example, coordinates in the roads shapefile are in meters. The units of length in the projected coordinate system is US Survey Feet, documented in the value of the UOMLength field of the projection structure.

x = [roads.X] * unitsratio('survey feet','meter');
y = [roads.Y] * unitsratio('survey feet','meter');

[roadsLat, roadsLon] = projinv(proj, x, y);

Read the boston_ovr.jpg image and worldfile.

RGB = imread('boston_ovr.jpg');
R = worldfileread(getworldfilename('boston_ovr.jpg'));

Read state boundary vectors for Massachusetts from the usastatehi shapefile using a selector to eliminate other states.

S = shaperead('usastatehi', 'UseGeoCoords', true, ...
    'Selector',{@(name) strcmpi(name,'Massachusetts'), 'Name'});

Open a figure with a Mercator projection and display the image, state boundary, and roads.

figure
axesm('mercator')

geoshow(RGB, R) 
geoshow(S.Lat, S.Lon, 'Color','red') 
geoshow(roadsLat, roadsLon, 'Color', 'green')

Set the map boundary to the image's northern, western, and southern limits, and the eastern limit of the state boandary within the image latitude bounding box:.

[lon, lat] = mapoutline(R, size(RGB(:,:,1)));
ltvals = find((S.Lat>=min(lat(:))) & (S.Lat<=max(lat(:))));
setm(gca,'maplonlimit',[min(lon(:)) max(S.Lon(ltvals))], ...
         'maplatlimit',[min(lat(:)) max(lat(:))])
tightmap

boston_ovr.jpg image copyright © GeoEye™, all rights reserved.

Input Arguments

collapse all

Map projection, specified as a scalar map projection structure (mstruct) or GeoTIFF info structure.

Data Types: struct

x-coordinates of one or more points in the projected coordinate system, specified as a scalar value, vector, matrix, or N-D array. Size must match the size of the y input.

Data Types: single | double

y-coordinates of one or more points in the projected coordinate system, specified as a scalar value, vector, matrix, or N-D array. Size must match the size of the x input.

Data Types: single | double

Output Arguments

collapse all

Geodetic latitudes of one or more points, returned as a scalar value, vector, matrix, or N-D array, in units of degrees.

Longitudes of one or more points, returned as a scalar value, vector, matrix, or N-D array, in units of degrees.

Introduced before R2006a

Was this topic helpful?