# How to georeference in MATLAB?

18 views (last 30 days)
Ali Almakhmari on 11 Sep 2022
Answered: KSSV on 15 Sep 2022
So guys I have a map as given in the google drive link (too big to attach here): https://drive.google.com/file/d/1XzeM835pHCJQ3hoi9uJgLSOLIe04J-k6/view?usp=sharing. I want to georeference this map's picture in MATLAB but according to the geotiffwrite command I need a ".tfw" file to do this...which I don't. However, I created this image and I know every coordinate of each pixel. On the horziontal axis of the image, its the longitude, and it stretches from -180 degrees to 180 degrees (left to right). And on the vertical axis of the image, its the latitude, and it stretches from 90 degrees to -90 degrees (up to down). The resolution of the picture is 3601 by 7201. And it follows those two equations:
P_vertical = -20*(La-90) + 1
P_horziontal = 20(Lo+180) + 1
For example, if you want to know the best pixel that corresponds to the coordinate Latitude = 0 (La = 0) and Longitude = 0 (Lo = 0), then use the previous equations and you will see that the pixel on the image that corresponds to that coordinare is (horziontal, vertical) = (3601, 1801). The map has a very simple transformation as you can see, and georeferencing it shouldn't be diffcuilt. But I just don't know how. Any help is appreciated.
Jeffrey Clark on 15 Sep 2022
@Ali Almakhmari, doesn't this part of the geotiffwrite examples suit your purpose?

KSSV on 15 Sep 2022
file = 'truemap_automatedEditedz.tif' ;
image([-180 180], [90 -90],A)

### Categories

Find more on Data Import and Export in Help Center and File Exchange

R2020b

### Community Treasure Hunt

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

Start Hunting!