Plot coordinates of a tif image

조회 수: 30 (최근 30일)
Madmad
Madmad 2024년 2월 21일
댓글: Cris LaPierre 2024년 3월 9일
Hello, I have say 'image.tif' which contains a greyscale information and a .json file containing metadata associated.
I can plot the image using:
[A,R] = readgeoraster('image.tif');
figure
mapshow(A,R)
However, it does come with X or Y axes in a unit I do not understand, value with x10^6, say 600,000 to 605,000 for Y axis. Same fo X. See figure attached from mapshow help page:
I would like to transform it into proper longitude/latitude, so °N/°E when I plot the image. In the metadata, there are different projection informationn such as projectedCRS, polygon coordinates and projection epsg/shape/transform values.
I tried using the function worldGrid and geoshow functions, but 1st) it takes ages to interpolate lat/lon and 2nd) my computer does not have enough memory to plot the results using geoshow(lat,lon,A). My images are pretty small but high resolution (20,000 x 20,000 pixels).
So my question, how can I convert my Y and X axes into latitude/longitude degrees on the plot? Any function that would do it? In the end I just need to plot a grayscale image with coordinate.
  댓글 수: 4
Dyuman Joshi
Dyuman Joshi 2024년 2월 22일
이동: Dyuman Joshi 2024년 2월 25일
Could you share the image here? Use the paperclip button to attach.
Madmad
Madmad 2024년 2월 26일
I could share but they are quite big (600 MB). I got it from public SAR dataset so you would need to make a free account (https://platform.capellaspace.com/user/login/?redirectConsole=%2Fsearch%2F)

댓글을 달려면 로그인하십시오.

답변 (1개)

Cris LaPierre
Cris LaPierre 2024년 2월 26일
Note that there is a projection associated with your SAR data. You need to know this projection in order to convert your scales to lat/lon. This should be incorporated into your geotiff file.
Follow this example to either display your projected data, or to unproject the data.
  댓글 수: 7
Cris LaPierre
Cris LaPierre 2024년 3월 5일
  1. You whould be able to determine the size of your image using any file browser. In order to load the image into memory, you will need at least that much RAM.
  2. You could use the same commands as in the example I shared above, but then plot using mapshow instead of geoshow. The main difference I discovered is that I had to plot lon as X and lat as y.
p = R.ProjectedCRS;
[x,y] = worldGrid(R);
[lat,lon] = projinv(p,x,y);
figure
mapshow(lon,lat,Z)
xlabel('Longitude (degrees)')
ylabel('Latitude (degrees)')
Cris LaPierre
Cris LaPierre 2024년 3월 9일
I have more details for you.
mapshow is faster because it assumes your image is in cartesian coordinates. The one we have been using - boston.tif - is, so this works. However, it is more likely than not that you geotiff is not. This is why you should use geoshow instead.
geoshow projects the image using the projection info in the geotiff. This can take some time, especially for very large files.

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by