[GRASSLIST:5413] please help me generate an adjaceny list

Help! I'm in dire need of an adjacency list for a polygon layer. I haven't
been successful in getting GRASS to compile (under cygwin) and have never
tried to add a command to GRASS. I *need* to generate an adjaceny file for
a project that builds a list of which polygons are next to which polygons
for all the polygons in a layer (liek the arcinfo palinfo command). Is
there a way to do this using one of the output files (v.out.arc?) and a
script? I've never asked anything in a frantic way like this, but I need
to generate the file in short order or suffer a weekend or converting all
my GRASS work to arcinfo. Please, think of the children.

OR

can someone point me in the right direction to adding a GRASS module?

Thanks for listening,
Jeff.

On Friday 31 January 2003 08:04 am, Jeff D. Hamann wrote:

Help! I'm in dire need of an adjacency list for a polygon layer. I haven't
been successful in getting GRASS to compile (under cygwin) and have never
tried to add a command to GRASS. I *need* to generate an adjaceny file for
a project that builds a list of which polygons are next to which polygons
for all the polygons in a layer (liek the arcinfo palinfo command). Is
there a way to do this using one of the output files (v.out.arc?) and a
script? I've never asked anything in a frantic way like this, but I need
to generate the file in short order or suffer a weekend or converting all
my GRASS work to arcinfo. Please, think of the children.

OR

can someone point me in the right direction to adding a GRASS module?

Thanks for listening,
Jeff.

You must use topology, so export + script does not help.
If topology is built (v.support), each boundary has information
about area on left/right side. Code may be like this:
for (i=1; i <= Map.n_lines; i++) {
    Line = &(Map.Line[i]);
    if (Lines->type != AREA) continue;
    lcat = rcat = 0;
    if (Lines->left != 0)
        lcat = Map.Att[Map.Area[Lines->left].att].cat;
    if (Lines->right != 0)
        rcat = Map.Att[Map.Area[Lines->right].att].cat;
    fprintf (stdout, "%d %d", lcat, rcat);
}

Radim