Skip to content

Conversation

@PaulWessel
Copy link
Member

It is useful to scripters to learn what the equivalent -R setting in degrees might be if one specifies an oblique region via -Rxmin/xmax/ymin/ymax+uunit. This PR adds that capability via -Wo which will write the w e s n numbers plus -Rstring as trailing text. Example:

gmt mapproject -R-2800/2400/-570/630+uk -Joc190/25/266/68/1:1 -Fk -C -Wo
164.589993465	210.6746652	30.1588817953	22.1514604447	-R164.589993465318/30.15888179527597/210.674665200366/22.15146044466763+r

or

Rstring=$(gmt mapproject -R-2800/2400/-570/630+uk -Joc190/25/266/68/1:1 -Fk -C -Wo -ot)

No tests are affected. Man page updated to show such an example.

It is useful to scripters to learn whhat the equivalent -R setting in degrees might be if one specifies an oblique region via -Rxmin/xmax/ymin/ymax+uunit.  This PR adds that capability via -Wo.
@PaulWessel PaulWessel added the enhancement Improving an existing feature label Mar 23, 2022
@PaulWessel PaulWessel added this to the 6.4.0 milestone Mar 23, 2022
@PaulWessel PaulWessel self-assigned this Mar 23, 2022
@maxrjones maxrjones added the add-changelog Add PR to the changelog label Mar 23, 2022
Copy link
Member

@joa-quim joa-quim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this mixes numeric and text outputs, maybe split split this option in -Wo for numeric only and -WO for the string only (e.g. "-R....")?

@PaulWessel
Copy link
Member Author

Yes, good idea. Will fix.

@maxrjones
Copy link
Member

Is it necessary to have another one or two modifiers for this feature or could the case of an oblique region via -Rxmin/xmax/ymin/ymax+uunit be automatically detected when using -WR or -Wr as an enhancement to #5782?

@joa-quim
Copy link
Member

Avoiding new modifiers is even better.

@PaulWessel
Copy link
Member Author

Well, those are two different things though.

  • -Wr|R deals with the rectangular lon/lat box that contains the oblique region. This is region you might want when pulling out a grid subset to ensure it ccovers your oblique area
  • -o|O deals with the equivalent oblique specification in degrees of the box defined by projected meters/km etc

They are not the same thing, so even thought I can know internally you used +u I dont want to report one of two different things.

@PaulWessel
Copy link
Member Author

Done. Example is now

gmt mapproject -R-2800/2400/-570/630+uk -Joc190/25/266/68/1:1 -WO

since -F and -C do not enter anyway (set by +u).

@PaulWessel PaulWessel merged commit b1dbd3d into master Mar 23, 2022
@PaulWessel PaulWessel deleted the obl-domain branch March 23, 2022 16:08
@anbj
Copy link
Contributor

anbj commented Mar 23, 2022

Given map, e.g.

gmt grdimage @earth_relief_10m -JS0/90/10c -R-10/20/60/70 -pdf test

I would like to find out lon/lat box that contains the oblique region (very related to #3099), hence I should use mapproject -Wr|R, per Paul's;

-Wr|R deals with the rectangular lon/lat box that contains the oblique region. This is region you might want when pulling out a grid subset to ensure it ccovers your oblique area

But not sure this works with lat/long? How would I find the box (in lat/long) containing the oblique region?

@PaulWessel
Copy link
Member Author

I must not understand what you mean. Your example is not an oblique projection and the region is the one you are giving it. I.e, a grid for -10/20/60/70 should fill your map, no?

@anbj
Copy link
Contributor

anbj commented Mar 23, 2022

Sorry to be unclear. I must educate myself on this. I thought the -JS-projection was oblique…

The essence, though, in my question is; given an -R (with -JS in this case) what are the coordinates of the rectangular box that contains this ‘pie slice’ (i.e. -R[..]r). This is the wrong place to ask question; sorry.

@PaulWessel
Copy link
Member Author

Hm, I see what you mean. When we say "oblique" in this context we mean a projection whose borders are not meridians and parallels. In that sense, your -JS is not oblique, while -JO etc are. Your pie slice is only "oblique" in the sense it is not a projected rectangle, but what that rectangle you talk about is depends on some other projection, no?

@anbj
Copy link
Contributor

anbj commented Mar 23, 2022

I’m in deep water here; I’m not familiar enough with projections to use correct wording. My point is maybe clearer in this post; #3099 (comment).

The ‘rectangle’ I’m talking about is basically the frame created by gmt. Thanks for answering, and sorry for misunderstanding!

PS! Your description of ‘oblique’ was very enlightening; is this the common way to describe ‘obliqueness’?

@PaulWessel
Copy link
Member Author

No worries.

@anbj
Copy link
Contributor

anbj commented Mar 24, 2022

I got an epiphany this morning; my question here, as well as in #3099, has basically been how to go from a pie slice (-R) to a rectangular map (-R[..]r). After reading more in the mapproject docs I see that (among other) -Wn is my solution.

Given -JS36/90/30c -R-15/60/68/90, what -R[..]+r do I need to use?

$ gmt mapproject -JS36/90/30c -R-15/60/68/90 -Wn0/0
-1.85242110467        62.3326996594

$ gmt mapproject -JS36/90/30c -R-15/60/68/90 -Wn1/1
126   80.9626773189

I.e.: -R-1.85242110467/62.3326996594/126/80.9626773189+r

Thanks for all help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-changelog Add PR to the changelog enhancement Improving an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants