EPSG code lookup for geotiffwrite

12 次查看(过去 30 天)
geotocho
geotocho 2024-3-8
回答: Vatsal 2024-3-25
I have a geotiff read into matlab and with this is R.ProjectedCRS describing the projected coordinate system.
My question is, when writing a new image using geotiffwrite how can I determine the required EPSG code in an automated way .
For example
geotiffwrite(['filename.tif'],raster,R,'CoordRefSysCode',epsgCode);
I had hoped that the EPSG code would be provided within R.ProjectedCRS, but there is only given a string providing the name of coordinate system (i.e., "WGS 84 / UTM zone 11N"). From this information, and using a method inherent to matlab, how can I look up the cooresponding EPGS code?
Thanks

回答(1 个)

Vatsal
Vatsal 2024-3-25
Hi,
I understand that you are seeking a method to automatically identify the EPSG code from a given projected coordinate system. In MATLAB, this can be achieved using the "wktstring" function, which will output the full CRS in WKT string form, the last ID tag in the WKT string is the 'CoordRefSysCode'.
Below is an example of how to use the function:
wktstring(R.ProjectedCRS,"Format","formatted")
For further details, you might find the following MathWorks documentation helpful:
I hope this helps!

Community Treasure Hunt

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

Start Hunting!

Translated by