[GRASSLIST:4088] Re: dynamic modeling advice? II

Alex Thorn amthorn1979 at yahoo.com
Wed Jul 17 13:01:29 EDT 2002


--- Radim Blazek <blazek at itc.it> wrote:
> sorry, here is full message:
> 
> On Friday 12 July 2002 10:29 pm, Alex Thorn wrote:
> > I'm now considering what portions of the analysis
> > should be performed by GRASS, and what portions it
> > would be more appropriate to use the C programs
> for.
> > I'm finding that much of the spatial manipulation
> > that I need (for example, the direction
> to-nearest-
> > object problem that I was asking about yesterday)
> > to do could be done by the C program fairly easily
> > without involving GRASS at all.  It seems that it
> > might even be possible only using GRASS to display
> the
> > output.  Meanwhile, it seems clear that every use
> > of GRASS for a spatial calculation slows down the
> > program runtime because of the necessity to create
> > support files for the resulting coverages.
> 
> Depending on how stable environment you need, you
> could 
> consider to use grass51 for vectors (if you wait a
> moment
> Bernhard will reply that nobody should use it,
> because it is
> experimental). Building support in grass51 is very
> quick because:
> 1) categories are saved with geometry (no attaching)
> 2) spatial index is used for nodes

I'm still pretty new to programming and GIS in 
general, as well as GRASS specifically, so pleas 
forgive me if I have trouble understanding exactly
what you mean.  I am currently using GRASS43 for my
project.  Is the concensus that it would be worthwhile
for me to switch to GRASS50 at minimum?

The idea of fast vector manipulation is interesting to
me, but I'm wondering how easy it would be to export
the results in an ascii format, so that it could be
read by the C program that is currently the core of
my model.

> (i run test now: 8s/340000 lines; i think, it was
> about 3h in grass50)

What were you testing?  Are these lines of a GRASS 
script?

> You can run grass51 and grass50 at the same time in
> 2 shells.
> Example for your direction to nearest (say that we
> want direction from
> points in A vector to nearest point in B vector):
> 
> nlines = Vect_get_num_lines (&AIn);
> for ( i = 1; i <= nlines; i++ ) {
>     Vect_read_line (&AIn, APoints, ACats, i);
>     point = Vect_find_line (Map, APoints->x[0],
> APoints->y[0], 0, 
>                            GV_POINT, thresh, 0);
>     Vect_read_line (&BIn, BPoints, BCats, point);
>     dir = atan2(BPoints->y[0]-APoints->y[0],
> BPoints->y[0]-APoints->x[0]);
>     Vect_cat_get(ACats, 1, &acat);
>     Vect_cat_get(BCats, 1, &bcat);
>     fprintf(stdout,"%d %d %f\n", acat, bcat, dir);
> }

This looks like C code.  I'm a bit confused as to
how this would fit together with GRASS.  Would this 
code need to be added to the actual GRASS source code?
I haven't actually figured out how to compile GRASS
from the source, and have been using precompiled
binaries.  Should I try to work on learning how to
compile from source, or is that more trouble than it 
is worth (I note that I would also have to compile
from source if I was going to use GRASS51 at all: the
binaries are evidently not yet available).

Could somebody clarify things for me a bit?

Thanks,
Alex

__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com



More information about the grass-user mailing list