Re: Polygon outlines pen attributes: use -W together with -Gp?
Paul Wessel <[email protected]>
| Newsgroups | gmane.comp.gis.gmt.user |
|---|---|
| Message-ID | <[email protected]> |
You could compute the distance from your polygon outline to points on a grid, then use grdmath to set all distances larger than $margin (in km) to NaN, and then paint that grid with some cpt so that you get fill just near the edges of the polygon, with nothing in the middle. The fill could be constant or gradually fade away. E.g., given polygon.txt, do something like 1. R=`gmt info polygon.txt -I11 # Get rectangular region of polygon to nearest whole degree 2. grdmath $R -I1 -fg polygon.txt LDIST polygon.txt = dist.nc # Compute distances from the perimeter 3 grdmask -Rdist.nc polygon.txt -NNaN/1/1 -Gmask.nc # Get a mask grid for the inside of the polygon 4. grdmath dist.nc mask.nc MUL DUP $margin LE 0 NAN MUL = margin.nc # Set nodes outside polygon to NaN, then set nodes more than $margin km away from perimiter to NaN as well. 5. echo "0 red $margin red" > red.cpt # Make a cpt that is either constant or linearly decaying from 0-$margin 5. grdimage -R -J margin.nc -Cred.cpt -Q -O -K >> ... Paul On Mar 2, 2014, at 3:58 PM, Kristof Koch <[email protected]> wrote: > Dear List, > > I have an arbitrary closed polygon occasionally way larger than my plot. I'd like to indicate the inside side of the polygon without filling the whole area. My idea is to have a solid outline (regular -W option) and add a fill pattern of specified width to the inside side of the outline. > > I read through the Cookbook carefully, especially chapter 9.13 "Specifying pen attributes" and 9.14 "Specifying area fill attributes", but there seems to be no "official" way of achieving this. > > I thought about shrinking the polygon a little bit and fill the developing gap via -Gp. However, this would lead to a variable width pattern due to projection distortion. > > Looking into the -t option (PDF transparency), I thought about replacing the pattern with a solid line of large width and some added transparency to achieve a similar result. So far I was unable to confine the line to the inside of the polygon. > > Any ideas are highly welcome. > > All the best, > Kristof > > To unsubscribe, send the message "signoff gmt-help" to [email protected] To unsubscribe, send the message "signoff gmt-help" to [email protected]