필터 지우기
필터 지우기

Change coordinate system of geotif from WGS 34 to EPSG:32628

조회 수: 3 (최근 30일)
Timbro
Timbro 2023년 6월 7일
댓글: Timbro 2023년 6월 14일
Hello
I have a geotif with data projected in WGS 84 (standart) and I want to convert it in EPSG:32628
since .tif files cannot be uploaded here, I saved it in a .mat (using geotiffread and save). Thus the data are in the file test.mat (attached). I want to read this data and export it in a new geotif but with different coordinate system, but I can't :
load test.mat
coordRefSysCode = 32628
geotiffwrite('test',A,R,'CoordRefSysCode',coordRefSysCode)
I get this error :
Error using geotiffwrite
Function GEOTIFFWRITE expected input number 3, R, to be either a 3-by-2 referencing matrix or a scalar map
raster reference object. Instead its type was: map.rasterref.GeographicCellsReference.
How can I do it ?
  댓글 수: 1
Timbro
Timbro 2023년 6월 9일
I understand from the error message that R should be different, but then the question is how can I get R as a 3-by-2 referencing matrix or a scalar map raster reference object ?

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

답변 (1개)

Daniele Sportillo
Daniele Sportillo 2023년 6월 14일
Hi Timbro,
you can try doing this:
load test.mat
coordRefSysCode = 32628;
M = makerefmat('RasterSize',R.RasterSize,'LatitudeLimits',R.LatitudeLimits,'LongitudeLimits',R.LongitudeLimits,'ColumnsStartFrom', R.ColumnsStartFrom);
geotiffwrite('test',A,M,'CoordRefSysCode',coordRefSysCode);
Please note that the function makerefmat will be removed in a future release.
You can verify that the matrix M produces the same GeographicCellsReference object with the following code:
R2 = refmatToGeoRasterReference(M,R.RasterSize);
Does it work as expected?
  댓글 수: 1
Timbro
Timbro 2023년 6월 14일
Hi Daniele,
Yes it works, it will save us a lot of time many thanks !
I would never have found it by myself..!

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

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by