Add two -R shorthands for projected coordinates#6094
Conversation
See feature request #6090.
|
I don't understand how this works. What if not centered in 0? |
The "center" of the map is the longitude and latitude indicated in -J. |
|
Radius seems like a misnomer here to me. Why not use -Rhalfwidth[/halfheight][+uunit] where halfheight defaults to halfwidth if not given?
|
|
If not entered then you do standard stuff like -R-600/200/-100/300+uk etc. |
Esteban82
left a comment
There was a problem hiding this comment.
I approved because I got the maps from the test right. I didn't revise the docs.
|
I don't know how to unlike my own comment... |
|
I find this option confuse. Many projections do not use a latitude parameter (that is lat_0 = 0). So this means the rectangle will always have to be around the equator, no? In fact I had a similar idea for the Julia wrapper but always gave up because I could never remember what -Rx was supposed to mean. |
I think even Mercator optionally takes that latitude, but it is not universal and for many it would mean Equator. The key use of this is to make lots of maps that all are centered on various locations and have the same dimensions - one would never want to use the Eckert project for this, for example (well, maybe your new Lester would). I do this all the time and this is just a logical simplification. Way more useful than the one we added for Kurt Feigl in 2016... |
|
BTW @meghanrjones I switched the syntax and docs to your suggestion. |
Ah, a bash-lovers short circuit thing ... still one not working for Mercator (and cousins) in other then around the equator. |
|
In other words there is room for improvement in our -J settings. |
But not to please this option (ofc there is the proj4 string syntax, etc) |
yes. I am waiting for Leo to respond to my change of refactoring before we schedule a chat focused on C refactoring things, such as pro, but no word yet - busy times. I also do not want to have that chat and then have 3 weeks of holiday delay any actual action. So maybe we have that chat in early January anyway. |
|
Sorry but I still think this is not a good solution. If I got it right this is for when one want to make a map with a certain Cartesian width centered in some point. As implemented the center point is the projection center that, as mentioned above, for may projections lies on the equator only. So this option works only sometimes. And why would we force the map center to be on the projection center? A better way would be to set |
|
Perhaps we can consider a +clon0/lat0 modifier to set a specific center projection point, with the default being the projection origin. That way, the users of projections that has a specific point (azimuthal for instance) can accept the default (as currently encoded) while others can use +c. |
|
Better to leave the +c clean as we do with +r -Rx[/y]+c => use projection center |
|
Requiring +c breaks backwards compatibility for the cases that have been used forever like this. Also, we do not have modifiers that take its arguments before the modifier, but I understand what you mean "+c means the last two args are center coordinates, not projected distances". I will think more about this. We do not want backwards incompatibilities in -R. |
|
I'm using +c like we use +r. Why would it break compatibility? |
|
Sorry, it would not. No coffee yet, no breakfast, you expecting me to engage in a technical conversation this early? |
|
Hawaiian chickens are well awaken already and for quite some time now. |
|
Here is the backwards issue I was thinking of. This currently works great (i.e., before we even merged this branch:
(This is the long-version of the first plot in the test above). As you see, it requires no +c to set the central point to 204/21 since that is set via -J. This has worked for a decade at least, so we do not want toads a +c as a requirement for it to continue to work. So the +c has to be optional I think. I do not think
would be a useful syntax as now the savings are gone. I also think the azimuthal projections are the ones where this is most useful but of course that is user-dependent. Hence, I think +c needs to be +clon0/lat0 with default to the projection center. This may be at Equator for many/most projections. So, a Mercator version of the above might be
I think your suggestion -Rhalfwidth[/halfheight][/lon0/lat0+c]+uunit could work but I do think passing those arguments to +c is a better implementation in line with most situations in GMT. So in summary, the shortcut was introduced because making such a square/rectangle centered on the azimuthal touch point can so easily be done this way, but I agree that for non-azimuthal and non-conic projections there would have to be more. We could accommodate this for those projections via optional latitudes, i.e. -JH[lon0[/lat0]/]width where the lat0 has no affect on the projection but lets us compute the (x,y) projected units of the center point and now we can do relative measurements from there. It is mostly those global projections plus some cylindrical that would need this info and then that is the logical way to set the projection center (in -J rather than in -R). |
but it would not be
That is the part that I'm against. We should not change the -J syntax (with no parallel in proj4) just to please -R |
|
OK, so we would know for -JA,S,G etc that we already have a valid default point so -R300+un+c is understandable. That means the syntax is actually [/lon0/lat0]+c then? What do you do with
then? Do we really want to parse that and somehow figure out that -150/75 can't be lon/lat since the halfwidth is negative, etc, etc? I can imagine cases where there is just no way to know. |
without +c the |
|
Well, the point is that the above ( |
|
(Speaking of |
Description of proposed changes
This PR is in response to #6090 and introduces two short-hand forms of the general projected region set via -Rxmin/xmax/ymin/ymax[+uunit]:
Note: For these shorthands the +u modifier is required. Below is a short test result added as part of PR:
Closes #6090.