[GRASSLIST:6579] Re: Who wants contour lines labeled "300.000000"?

Dylan Beaudette dylan at iici.no-ip.org
Wed Apr 20 18:19:49 EDT 2005


I have experienced similar frustration with contour labeling in GRASS. I think 
that part of the reason there aren't yet any robust feature labeling routines 
is that GRASS is not (currently) aimed at cartographic output (please correct 
me if i am wrong on this Markus, Hamish, and others...). 

I have found GMT to be an excellent solution for creating cartographic 
products directly based on GRASS rasters. Vector data is a little bit more 
complicated, but GMT has some amazing contouring, and contour labeling 
routines that make for some very slick looking maps: here is a rather crappy 
one, but the contours are nice --


for some thoughts on GRASS-GMT operations take a quick look at:

and sooner or later i will finish an article for the GRASS news letter on this 

Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis

On Wednesday 20 April 2005 02:05 pm, Dan Jacobson wrote:
> Who wants contour lines marked "300.000000"?
> But that's what we're stuck with
> r.contour input=c4 output=c5 step=5
> d.vect display=attr attrcol=level map=c5
> Let's see what else we might try in GRASS 6.0.0beta2 (2005).
> v.label map=c5 column=level labels=c8
> d.paint.labels labels=c8 #BROKEN, so forget it.
> v.out.ascii also broken, so forget examining anything. "It just
> doesn't write any files anymore."
> echo ALTER TABLE c5 ADD COLUMN contour integer|db.execute
> echo UPDATE c5 SET contour = level|db.execute #FAILS,
> who knows how to write this, not me. Docs of course not forthcoming.
> I can't even do "SET contour = 2 + 2", "SET contour = 2" works however.
> And who knows how to remove that column I just added now that I won't
> be using it. Not me. Maybe how to do it is in
> /usr/lib/grass/docs/html/sql.html but I can't tell. Wait:
> echo SELECT cat,level FROM c5|db.select -c|
> perl -pwe 's/(.*)\|(.*)\..*/UPDATE c5 SET contour = $2 \
> WHERE cat = $1;/'|db.execute #WORKS! (Unless you forget the ';': segfault)
> OK, we can finally do
> d.vect c5; d.vect display=attr attrcol=contour map=c5 xref=center \
> bgcolor=white lcolor=black lsize=7
> Quit while I'm ahead?  Well can't I have more than one label along a
> contour line, like those maps that Mom used to make?
> Maybe that's what d.paint.labels was for, before it got injured or
> something.
> I know, I'll make a skinny region, the labels are sure to go there.
> d.erase
> g.region w=228000 e=228100
> d.vect c5 #testing: yes, contours appear only in region. Good.
> d.vect display=attr attrcol=contour map=c5 #No, labels still written
> all over the place. BUG.
> I know. I will sit back and let the pros tell me the pro way to put
> more than one contour label on a contour line. Or maybe it's like
> Perl: there's more than one way to do it.
> GRASS: there's less than one way to do it.
> ----
> In the article above, Dan Jacobson reflected the frustration he was
> having with GRASS.

More information about the grass-user mailing list