"Auto mode" for -JL when -R is used with ISO code?

The option to set geographic regions by specifying ISO country codes is awesome for getting a quick plot of a specific country or continent. Lets use Germany (DE) for this example.

Unfortunately there seems to be no way for an equally quick setting of the projection type. If I omit -J and hope for the best -JQ15c+ is automatically set in the background.

mapDE2-JQ

gmt coast -W -RDE+R10m -Ba -N1/1p,darkred -Saliceblue -pdf mapDE2

This is generally a nice thing but leads to severe distortions at the latitudes I’m interested in. So if I want a plot as Lambert Conic Conformal projection (-JL) I still need to figure out my variables to populate -JLlon0/lat0/lat1/lat2/width. I was just able to lazily say “give me a map of Germany” by using -RDE but now I’m annoyed that I need to figure out the values for -JL.

gmt coast -W -RDE+R10m -JL10.5/51/49/53/17c -Ba -N1/1p,darkred -Saliceblue -pdf mapDE

I dream of something like -JLwidth. Just give the desired type of projection and the desired width and GMT does the rest. Maybe not always perfect but for a quick and dirty map quite a useful feature. So what’s needed?

-JLlon0/lat0/lat1/lat2/width

In my eyes this could be rather easily calculated from -R. The lon0 and lat0 are the middle of -RDE. lat1 and lat2 are – for simplicity – 1/3 and 2/3 from the distance between highest and lowest latitude.

All my doc reading and experimentations lead nowhere. What do you think – might this be a good idea for a feature request? Maybe not only for -JL but other projections as well?

You mean

julia> coast(region="DE+R10m", shore=true, water=:aliceblue, borders="1/1p,darkred", title="Happy New Year of 2019", fmt=:png, show=1)

I agree 2019 was better than 2020

And we could allow -JLwidth, -JA width, etc and simply default to sensible values for a given region.

Yes, and I need a way of consulting GMT->common->R.wesn directly from the lib but don’t want to try to wrap the GMT_CTRL struct. I currently hacked a trick but want a cleaner solution.
But we will talk about that next year probably.

For Mercator we set central lon and lat to NaN, and if after parsing -J any of then is staill NaN then we set to midlon and mid-lat, respectively. I am imagine doing the same to all -J so that -JBwidth is treated just like @KristofKoch suggests.

@Joaquim you convinced me with your perseverance to give Julia a try … :wink:

Glad to see that you deem -J[projection][width] a useful feature, too. Might this work as well when wrangling gridded data?

Youre wellcome to the future but the auto-guess facility is not yet committed (probably later today).

Regarding the -J[projection][width] once it’s implemented it will valid for all modules (it’s a global option).
,

One more idea if this becomes implemented – if “auto mode” engages I think it would be nice to have a way to extract the used parameters as a starting point for your own optimizations other than sieving through the output of -Vd. Maybe just elevate this info so that it is shown with -Vi? What do you think?

Warming up this ancient topic again as I’m doing more GMT related stuff recently. Apparently the idea wasn’t pursued further as I sifted through the pull requests on GitHub and wasn’t able to find anything related.

Maybe there still is some interest in this convenient feature?

The super lazy version would be something like

-RDE+e1 -JL

having anything needed for -JL guessed from -R to support the lazy user (a.k.a. me) even more.