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.
> Ideally, vector layers should probably have associated colour tables,
> as is the case for raster layers.
Well, this will be addressed by the new vector format, won't it ?
I would hope so.
> 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.
--
Glynn Clements <glynn.clements@virgin.net>