Lat/Lon to Row/Colmn

4 次查看(过去 30 天)
Sharareh Akbarian
Sharareh Akbarian 2019-12-3
HI everyone,
I have a geotiff image, and I want to convert lat and long coordinates of several point into pixel coordinate. How can i do it?

回答(1 个)

Sourav Bairagya
Sourav Bairagya 2019-12-9
There are two functions which you can use.
If you have the GeoTIFF file, then “geotiffread”helps to read a georeferenced grayscale, RGB, or multispectral image or data grid from the GeoTIFF file specified by filename into A and creates a spatial referencing object, R.
[A, R] = geotiffread(filename);
If you already have the reference object and corresponding latitudes and longitudes, then you can use “latlon2pix” function.
[row, col] = latlon2pix(R,lat,lon);
It calculates pixel coordinates row, col from latitude-longitude coordinates ‘lat’, ‘lon’. ‘R’ is either a 3-by-2 referencing matrix that transforms intrinsic pixel coordinates to geographic coordinates, or a geographic raster reference object. ‘lat’ and ‘lon’ are vectors or arrays of matching size. The outputs row and col have the same size as ‘lat’ and ‘lon’. ‘lat’ and ‘lon’must be in degrees.
For more information you can follow these links:

Community Treasure Hunt

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

Start Hunting!

Translated by