MATLAB Answers

How to use correctly 'proj' field in 'projfwd' function in Matlab?

19 views (last 30 days)
Aviad Bublil
Aviad Bublil on 23 Jun 2018
Answered: Thomas Rechtman on 13 Apr 2021
I have two columns of `lat` and `lon`, which I want to transform into an `[x,y]` in a robinson projection, so later it can be displayed onto `worldmap` correctly, using `imagesc` function.
I read about `projfwd` function, which requires `(proj,lat,lon)`. I don't have a geotiff file, so I don't see how I can use 'geotiffinfo' to obtain it.
However, Matlab identifies `robinson` as a projection in a different context, as [in here][1].
If so, why can't I just use `[x,y] = projfwd('robinson',lat,lon)` (doesn't work)? Alternatively, how can I know what struct do I need as `proj` input.

Answers (1)

Thomas Rechtman
Thomas Rechtman on 13 Apr 2021
you have to use defaultm('robinson') for projection, so matlab will obtain all the necessary information.
proj = defaultm('robinson')
Alternatively you can also use projcrs(*insert appropriate code*)




Community Treasure Hunt

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

Start Hunting!