Documentation Center

  • Trial Software
  • Product Updates

projfwd

Forward map projection using PROJ.4 map projection library

Syntax

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

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

expand all

Overlay Boundary of Massachusetts on Orthophoto of Boston

Read vector data for state boundary of Massachusetts (in latitude and longitude).

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

Obtain the projection structure for the orthophoto and project the state boundary vectors to it (Massachusetts State Plane coordinate system, U.S. Survey Feet).

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

Read and display the 'boston.tif' orthophoto image.

[RGB, R, bbox] = geotiffread('boston.tif');
figure
mapshow(RGB, R)
xlabel('MA Mainland State Plane easting, survey feet')
ylabel('MA Mainland State Plane northing, survey feet')

Overlay the state boundary and set map limits to show a little more detail.

hold on
mapshow(gca, x, y,'Color','black','LineWidth',2.0)
set(gca,'XLim', [ 645000,  895000], ...
        'YLIm', [2865000, 3040000]);

boston.tif image copyright © GeoEye™, all rights reserved.

Input Arguments

expand all

proj — Map projectionscalar structure

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

Data Types: struct

lat — Geodetic latitudesscalar value | vector | matrix | N-D array

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

lon — Longitudesscalar value | vector | matrix | N-D array

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

expand all

x — Projected x-coordinatesscalar value | vector | matrix | N-D array

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

y — Projected y-coordinates scalar value | vector | matrix | 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.

See Also

| | | |

Was this topic helpful?