Documentation

This is machine translation

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

map2pix

Convert map coordinates to pixel coordinates

Syntax

[row,col] = map2pix(R,x,y)
p = map2pix(R,x,y)
[...] = map2pix(R,s)

Description

[row,col] = map2pix(R,x,y) calculates pixel coordinates row,col from map coordinates x,y. R is either a 3-by-2 referencing matrix defining a 2-dimensional affine transformation from intrinsic pixel coordinates to map coordinates, or a map raster reference object. x and y are vectors or arrays of matching size. The outputs row and col have the same size as x and y.

p = map2pix(R,x,y) combines row and col into a single array p. If x and y are column vectors of length n, then p is an n-by-2 matrix and each p(k,:) specifies the pixel coordinates of a single point. Otherwise, p has size [size(row) 2], and p(k1,k2,...,kn,:) contains the pixel coordinates of a single point.

[...] = map2pix(R,s) combines x and y into a single array s. If x and y are column vectors of length n, the s should be an n-by-2 matrix such that each row (s(k,:)) specifies the map coordinates of a single point. Otherwise, s should have size [size(X) 2], and s(k1,k2,...,kn,:) should contain the map coordinates of a single point.

Examples

% Find the pixel coordinates for the spatial coordinates 
% (207050, 912900)
R = worldfileread('concord_ortho_w.tfw');
[r,c] = map2pix(R, 207050, 912900);

Introduced before R2006a

Was this topic helpful?