GeoTIFFを読み込めない
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
こんにちは。
GeoTIFFを読み込み、地図を表示させたいのですが、エラーになってしまいます。
どうしたらよいでしょうか?
[A,R] = readgeoraster("Dynamic Surface.tif");
mapshow(A,R)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/754844/image.png)
0 commentaires
Réponse acceptée
Kojiro Saito
le 30 Sep 2021
GeoTIFF画像の座標系が地理座標系か投影座標系で使う表示用の関数が変わります。
readgeorasterの第2出力(R)がMapCellsReferenceとかMapPostingsReferenceという投影座標系ではmapshowを使います。
例えばドキュメントの例にあるboston.tifは投影座標系の画像です。
[A,R] = readgeoraster('boston.tif');
whos R
mapshow(A,R)
一方でRが GeographicCellsReferenceやGeographicPostingsReferenceの場合はgeoshowで可視化できます。
[A2,R2] = readgeoraster('n39_w106_3arc_v2.dt1','OutputType','double');
whos R2
latlim = R2.LatitudeLimits;
lonlim = R2.LongitudeLimits;
figure
usamap(latlim,lonlim)
geoshow(A2,R2,'DisplayType','surface')
demcmap(A2)
mapshowで出ているエラーから推測すると、お使いのデータの座標系(R)がMap**の投影座標系になっていないと思われます。
Geographic**の座標系になっていたら、geoshowをお使いになってはいかがでしょうか。
11 commentaires
Kojiro Saito
le 11 Oct 2021
添付ありがとうございます。
A(:, :, 4)は0か255の2値になっていて、ピクセルの輝度値が画像の領域内なら255、領域外なら0になっているだけでしたね。
A(:, :, 1:3)の色情報を緯度、経度にマッピングするには不要の情報でした。
[A, R] = readgeoraster("Sample.tif");
p = R.ProjectedCRS;
[x,y] = worldGrid(R);
[lat,lon] = projinv(p,x,y);
geoshow(lat,lon, A(:,:,1:3))
geoshowの中に緯度経度座標に投影したAの色情報(1:3)だけ入れればできました。
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/763801/image.jpeg)
Plus de réponses (0)
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!