How can I use the Mapping Toolbox 2.7.2 (R2009a) to map a specific region of pixels to lat-lon coordinates?

2 views (last 30 days)
I am using a GeoTIFF file, and I would like to know how to do the necessary projections to allow me to map pixels to latitude-longitude coordinates.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 Oct 2013
You can relate image rows and columns to latitude-longitude (if the GeoTIFF file is referenced to a geographic coordinate system) or to map X-Y coordinates (if the GeoTIFF is referenced to a projected coordinate system). First call GEOTIFFINFO and examine the INFO structure that it returns. Examine the 'ModelType' field to see what kind of system the image is in. Then you can use the 3-by-2 referencing matrix in the 'RefMatrix' field of the INFO structure to map X-Y or latitude-longitude limits to column and row limits. See functions MAP2PIX and LATLON2PIX.
If it turns out that the image is in a projected coordinate system but you have limits that are specified as a latitude-longitude quadrangle, you can pass the INFO structure to the PROJFWD function, along with latitudes and longitudes defining the corner points of the quadrangle. It will return those corner points in map X-Y, which you can pass on into MAP2PIX.
Note that MAP2PIX and LATLON2PIX may return row/column values that are less than 1 or that exceed the number or columns or rows in the image. In this case you can clamp them before calling IMREAD.
As a final step, work with PIX2MAP or PIX2LATLON in combination with MAKEREFMAT, to create a referencing matrix that is appropriate to the sub image returned by IMREAD.

More Answers (0)

Products


Release

R2009a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!