Lat/Lon to Row/Colmn
4 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
Sourav Bairagya
on 9 Dec 2019
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:
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!