draw rec xlo ylo xhi yhi draw recf xlo ylo xhi yhi
The problem with these functions is that they use XY coordinates, and most of our plots are in world coordinates. Of course it is possible to convert between these two, but doing that every time you need to draw a rectangle is really annoying.
So I took sometime to write a script that does that:
draw rec lon_min lon_max lat_min lat_max <fill> <warn on|off>
It needs at least the four coordinates. There are optional parameters to draw a filled or unfilled rectangle, and to turn on or off warning messages.
Here's an example:
ga-> open vegetation.ctl ga-> d mask ga-> drawrec 285 310 -12 5 ga-> drawrec 180 240 -5 5 1
And here's the code:
*
* drawrec.gs
*
* This function draws a rectangle over a map using World Coordinates,
* i.e., longitude and latitude.
*
* Usage: drawrec lon_min lon_max lat_min lat_max <fill> <warn on|off>
* <fill> can be 0 or 1
* <warn on|off> can be on or off
*
* Written by Henrique Barbosa July 2004
* Last update September 05
*
function drawrec(args)
* Get arguments
Rxa = subwrd(args,1)
Rxb = subwrd(args,2)
Rya = subwrd(args,3)
Ryb = subwrd(args,4)
fil = subwrd(arqs,5)
opt = subwrd(args,6)
* Test for parameters
if (Rxa='' | Rxb='' | Rya='' | Ryb='')
say 'usage: drawrec lon_min lon_max lat_min lat_max