[GRASSLIST:876] Re: GMT / GRASS use / shp2gmt
Allan Hollander
adh at ice.ucdavis.edu
Tue Apr 25 19:14:35 EDT 2006
Trevor,
I'm a rank beginner at GMT but in my one exercise to date with it I
learned the following. Mark Fenbers has modified the shp2gmt.c file to
include the attribute info from the dbf file into the multi-segment
separator of the psxy input file. His code is given in his message here:
http://www.mechanik.tu-darmstadt.de/GMT-Help/Archiv/11021.html.
The output from his shp2gmt version looks like this for a tiny extract
from a state map of the US:
> Polygon #0 nVertices=17 nParts=1 cat=2 AREA=0 PERIMETER=0.224 STATESP020=3 STATE="Alaska" STATE_FIPS="02"
-2.86129e+06 6.01613e+06
-2.86152e+06 6.01607e+06
-2.86163e+06 6.01615e+06
-2.86178e+06 6.01631e+06
-2.86248e+06 6.01724e+06
-2.86327e+06 6.01807e+06
etc.
What I can then do is write an awk script to substitute in the correct
-G and -W plotting parameters depending on the attributes. For instance
running this bit of awk over the above input file
{if ($0 ~ /Alaska/) printf "> -G175 -Wblack\n";
else print;}
should transform it into an input file where Alaska is plotted with a grey
fill. With more complicated lookups in the awk script, one can do pretty
sophisticated thematic mapping using this approach.
Best wishes,
Allan Hollander
---
On Tue, 25 Apr 2006, Trevor Wiens wrote:
> Grudgingly I'm using GMT after working through Dylan's example and am
> getting it to be somewhat functional.
>
> I will be needing to script the building of a large number of maps
> which I may store either in PostGIS or GRASS.
>
> I've noticed in the use of shp2gmt that there is no way of adding in a
> z attribute for use with the thematic colour assignment feature in GMT.
> If necessary I can extract bits based on different attributes and add
> them in separately, but it would be nice to be able to simply define a
> colour them once and be done with it. Any suggestions on how I can turn
> an attribute column in GRASS into a z-element that will be converted
> with shp2gmt would be appreciated.
>
> T
>
--
More information about the grass-user
mailing list