projfwd

Forward map projection using PROJ.4 map projection library

Description

example

[x,y] = projfwd(proj,lat,lon) returns the x and y map coordinates from the forward projection transformation. proj is a structure defining the map projection. proj can be an mstruct or a GeoTIFF info structure. lat and lon are arrays of the latitude and longitude coordinates.

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

Display the state boundary of Massachusetts over an orthophoto of Boston.

First, read geographic vector data for the state boundary of Massachusetts.

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

Get projection information about the orthophoto using geotiffinfo. Then, project the state boundary vectors.

proj = geotiffinfo('boston.tif');
[x,y] = projfwd(proj,S.Lat,S.Lon);

Read and display the orthophoto image of Boston.

[A,R] = readgeoraster('boston.tif');
mapshow(A,R)
xlabel('MA Mainland State Plane easting, survey feet')
ylabel('MA Mainland State Plane northing, survey feet')

Display the state boundary. Show more detail by setting the map limits.

mapshow(x,y,'Color','k','LineWidth',2)
xlim([ 645000  895000]);
ylim([2865000 3040000]);

Input Arguments

collapse all

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

Data Types: struct

Geodetic latitudes of one or more points, specified as a scalar value, vector, matrix, or N-D array, in units of degrees. Size must match the size of the lon input.

Data Types: single | double

Longitudes of one or more points, specified as a scalar value, vector, matrix, or N-D array, in units of degrees. Size must match the size of the lat input.

Data Types: single | double

Output Arguments

collapse all

x-coordinates of one or more points in the projected coordinate system, returned as a scalar value, vector, matrix, or N-D array.

y-coordinates of one or more points in the projected coordinate system, returned as a scalar value, vector, matrix, or N-D array.

Introduced before R2006a