Clear Filters
Clear Filters

EPSG code lookup for geotiffwrite

10 views (last 30 days)
geotocho
geotocho on 8 Mar 2024
Answered: Vatsal on 25 Mar 2024
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

Answers (1)

Vatsal
Vatsal on 25 Mar 2024
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!