[GRASSLIST:7625] Re: Synergy between Grass/Python/GMT
Brent Wood
b.wood at niwa.co.nz
Tue Jul 19 19:04:38 EDT 2005
On Mon, 18 Jul 2005, David Finlayson wrote:
> I am wondering if it makes more sense to break up the program into
> separate scripts?
>
> 1) Convert the color table from grass to gmt (g.out.colortable format=gmt)
> 2) Converting the raster (r.out.gmt)
> 3) Suggest output for -R and -J (maybe keep this in GMT land)
>
(Background)
I have a written a shell script which I use to generate a GMT version of a
QGIS project. I can create a view of various PostGIS layers in QGIS, set
line/polygon/point colors and polygon fills. The script parses a QGIS
project file, identifies the map extent & PostGIS layers, extracts the
relevant features, converts to GMT vector format & writes a script to plot
the files using the QGIS region & colors.... Pretty basic, lots of things
it doesn't do, but the resulting GMT files & script make generating a GMT
plot from an on screen view very easy. (The Postgis to GMT conversion is
via a perl script someone else (with much better programming skills)
wrote)
(comments)
I think a modular, generalised approach will offer more to users than a
monolithic approach, so the idea of several specific functions to export
raster & vector data for GMT is great.
Is there any way such capability could be added to gdal/ogr instead of
being GRASS specific? I know GDAL has some GMT support now, so
things like geotiff <-> gridfile can be done, but color pallete
support within GDAL would be tidier. Also adding GMT vector format
to ogr would be a much more versatile approach than a GRASS specific
function, and would also work with GRASS as well.
> I just don't like the spaghetti code I was writing.
I'm more a fan of functionality than elegance, so I'll happily leech off
any contributions in this area :-)
> On 7/18/05, Dylan Beaudette <debeaudette at ucdavis.edu> wrote:
> > David,
> >
> > Thanks for the reply. The lack of good hard copy output from GRASS has
> > driven me to do some hackish things in order to get GMT to produce my
> > maps.... I would be more than happy to collaborate on getting a working
> > GRASS-GMT framework (python seems like the best glue language as you
> > have demonstrated!) . I am excited about trying your script, as it
> > solves the color pallette problem that I had been facing for a while. I
> > am also working on a v.out.gmt script to convert GRASS vector data and
> > attributes into GMT format. Currently the only way to get GRASS vector
> > data into GMT is to convert to shapefile, and then convert the geometry
> > to GMT format.
Are you interested in a copy of the PostGIS -> GMT perl script I mentioned
above? It's small enough to post, but isn't strictly a GRASS function. I'm
also interested in how you turn shapefiles into GMT (and vice versa). My C
coding isn't up to much more than spelling the name of the language, so I
haven't done much with shapelib, or Ben's gmt version that I never got
working properly... (but I guess these are more GMT list questions than
GRASS...)
Anyway, I'm very interested in these capabilities, and also the ability to
invoke GMT to plot data from R. I believe the PostGIS/QGIS/GRASS/GMT/R
suite could be the most powerful analytical GIS suite available, so any
work to enhance the interoperability of these packages is fantastic!
Thanks,
Brent Wood
More information about the grass-user
mailing list