How to specify geotiff coordinate if the RefMatrix is empty?

2 ビュー (過去 30 日間)
Jose Valles
Jose Valles 2018 年 9 月 4 日
編集済み: Jose Valles 2018 年 9 月 9 日
Hello,
I would like to know how I can visualize and extract the lat-lon information from my geotiff file. When I use the geotiffinfo, it appears that my file coordinate are from 0 to 360 degrees since I opened in ArcGIS and the extent are Top: 19.10, Right: 283.72, Bottom: 6.82 and left: 267.35. I would like to extract the lat and long values in the other format (e.g. -92.64, 6.82)
Additionally, the RefMatrix variable in the Geotiffinfo function appears empty.
The geotiff file is attached in this question

採用された回答

KSSV
KSSV 2018 年 9 月 5 日
tiffile = 'lluvia_15.tif' ;
[A, R] = geotiffread(tiffile);
[nx,ny] = size(A) ;
S = geotiffinfo(tiffile) ;
L = S.GeoTIFFTags.ModelTiepointTag ;
lons = L(:,4) ; lats = L(:,5) ;
min_lon = min(lons) ; max_lon = max(lons) ;
min_lat = min(lats) ; max_lat = max(lats) ;
image([min_lon max_lon],[min_lat max_lat],A)
  3 件のコメント
KSSV
KSSV 2018 年 9 月 6 日
dx = (max_lon-min_lon)/(nx-1) ;
dy = (max_lat-min_lat)/(ny-1) ;
x = min_lon:dx:max_lon ;
y = min_lat:dy:max_lat ;
Jose Valles
Jose Valles 2018 年 9 月 9 日
編集済み: Jose Valles 2018 年 9 月 9 日
Thanks... It creates the vector that contains the information that I wanted. However, when I plot the geotiff file vs. a shapefile, the latter show the polygon upside down. After reviewing the plot, i realized that the shapefile is correct and the geotiff plot is not, since the y-axis has to be from 8 to 18 and not from 18 to 8
Here is the code that I used for that
x = wrapTo180(x) % Wrap angle in degrees to [-180 180]
image(x,y,A)
hold on
ES = shaperead('centroamerica.shp', 'usegeocoords', true);
geoshow([ES.Lat],[ES.Lon], 'Color','k');
You can find attached the shapefile and the geotiff file that I have used
Thank you so much for your answer.

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by