[GRASS5] d.vect.area

M Lennert fa1079 at qmul.ac.uk
Thu Jan 31 12:48:36 EST 2002


From:           	Glynn Clements <glynn.clements at virgin.net>
Date sent:      	Thu, 31 Jan 2002 18:37:28 +0000
To:             	"M Lennert" <fa1079 at qmul.ac.uk>
Copies to:      	grass5 at grass.itc.it
Subject:        	Re: [GRASS5] d.vect.area

> 
> M Lennert wrote:
> 
> > > > I was just wondering, Eric, why you decided to implement 
> > > > d.vect.area with a cat-rgb file option, and not with the catnum 
> > > > option that was in d.area. This means that for scripts like the 
> > > > d.area.class I posted last week, I will have to go through a 
> > > > temporary file which will hamper perfomance again... I guess all 
> > > > this will not be a problem with the new vector format, but for the 
> > > > time being, I liked the catnum option.
> > > 
> > > d.area's "catnum=" option just takes a list of categories, not
> > > category/colour pairs.
> > 
> > Well it does in the sense that you can list all the categories you want to plot and the color you 
> > want to plot them in...
> 
> "catnum=" takes a list of categories; "fillcolor=" takes a singles
> colour. d.area fills a set of categories in a single colour. 
> d.vect.area fills each category in a (potentially) different colour.
> 
> > > Also, there's a limit on the maximum length of a command line (or,
> > > more usually, of the combined size of the command line and the
> > > environment list). Passing the colours via the command line would
> > > limit the maximum number of categories which could be coloured.
> > 
> > I guess my own test examples were just too limited to explode the command line...as I said I 
> > only tried with 589 areas.
> 
> Is that one call to d.area with 589 categories or 589 calls to d.area,
> each with a single category?
> 
> Assuming ARG_MAX == 4096 (typical), the former would allow less than 7
> characters per category (7 * 589 = 4123). That is just sufficient if
> each category is just an integer, but you wouldn't be able to have 589
> number/colour pairs.

Ok, I understand. My categories were five digit integers, so that was alright even doing one call 
to d.area with 589 categories in one color.

 
> > > As for efficiency, a version of d.area.class based upon d.vect.area
> > > would only need to create the legend file and call d.vect.area once,
> > > rather than having to call d.area once per colour.
> > 
> > I'm quite inexperienced in programming, but doesn't the writing to a file take much more time 
> > than calling a module ?
> 
> Spawning a command once could potentially take more time than writing
> a file (particularly on Cygwin). Both fork() and execve() do quite a
> lot of work; program startup (loading shared libraries, relocation)
> can also be quite expensive.
> 
> Spawning a command multiple times will definitely take more time.
> 

Ok, well I'll reimplement d.area.class for use with d.vect.area...

Thanks for the insights!

Moritz



More information about the grass-dev mailing list