Faking Node Attributes

Node attributes are useful for classifying nodes according to shared arcs. The following routine generates a node attribute table for a coverage.


&r NBUILD [cover] {point_cover} {ADDXY}

builds a node attribute table (NAT) for node features in a coverage, optionally adding X,Y coordinates.


arguments

[cover] - the coverage for which to build NAT.

{point_cover} - optional NODEPOINT coverage to be created.

{ADDXY} - if specified, X,Y coordinates will be added to the NAT.

notes

discussion

NBUILD is intended primarily for coverages where node attributes may be generated on-the-fly (e.g. by an SML). Because tracking internal node numbers not possible, an existing NAT cannot be rebuilt after any edit that would affect node numbering.

When a NAT is built, three items are created: ARC_, [cover]_, and [cover]_ID. ARC_ represents the internal number of the first arc encountered which which uses this node. The value of [cover]_ is equal to the node number; initially, [cover]_ID is equal to [cover]_.

Because the COPYCOV and RENAMECOV commands do not rename NAT items, this will need to be done manually using MODITEM. [See MODITEM in the online help for further reference.]


To download the install pack, click HERE. Unzip in a temporary directory and execute NBUILD.BAT.


EXAMPLE ONE: Classifying nodes according to arc attributes

Polygon coverage VEG has seven vegetation boundary types (see Faking Cursors):

TYPE TYPE_TXT

0    Edge of Project Area
1    Conifer/PJ
2    Conifer/Sagebrush
3    Conifer/Grassland
4    PJ/Sagebrush
5    PJ/Grassland
6    Sagebrush/Grassland
Figure 1

Nodes at vegetation transitions are to be classified as follows (lookup table LUT.VEGC):

TYPE TYPE_TXT

-9   Degenerate (pseudo node)
 0   Edge of Project Area
 1   Conifer/PJ/Sagebrush
 2   Conifer/PJ/Grassland
 3   Conifer/Sagebrush/Grassland
 4   PJ/Sagebrush/Grassland
First, generate the node attribute table (the nodepoint cover VEG_NP will be used in Example Two below):

&r nbuild veg veg_np
Then, add TYPE and TYPE_TXT to VEG.NAT:

ADDITEM VEG.NAT VEG.NAT TYPE 2 2 I
ADDITEM VEG.NAT VEG.NAT TYPE_TXT 30 30 C
The following routine will calculate the attributes in TABLES:

&routine ncalc

&define co -5 &var
&define pj -6 &var
&define sb -7 &var
&define gl -8 &var
&define ep -9 &var
&define i -11 &var
&define j -12 &var
&define val -13 &var

&rem *** set up cursor loop

SEL VEG.NAT
&r cursor declare master veg.nat
&rv [i]
&while &ne [i] -1 &do
   CALC [val] = VEG_
   &sv [co] 0
   &sv [pj] 0
   &sv [sb] 0
   &sv [gl] 0
   &sv [ep] 0
   SEL VEG.AAT
   RES FNODE_ = [val] OR TNODE_ = [val]
   &r cursor declare relate veg.aat
   &rv [j]
   &while &ne [j] -1 &do
      CALC [val] = TYPE

      &rem **** find species composition

      &if &eq [val] 1 &do
         &sv [co] 1
         &sv [pj] 1
      &elseif &eq [val] 2 &do
         &sv [co] 1
         &sv [sb] 1
      &elseif &eq [val] 3 &do
         &sv [co] 1
         &sv [gl] 1
      &elseif &eq [val] 4 &do
         &sv [pj] 1
         &sv [sb] 1
      &elseif &eq [val] 5 &do
         &sv [pj] 1
         &sv [gl] 1
      &elseif &eq [val] 6 &do
         &sv [sb] 1
         &sv [gl] 1
      &else
         &sv [ep] 1
      &end
      &r cursor relate next
      &rv [j]
   &end
   &r cursor relate remove
   &r cursor master makecurrent

   &rem **** set TYPE

   &if &eq [ep] 1 &do
      CALC TYPE = 0
   &elseif &eq %<[co] + [pj] + [sb]> 3 &do
      CALC TYPE = 1
   &elseif &eq %<[co] + [pj] + [gl]> 3 &do
      CALC TYPE = 2
   &elseif &eq %<[co] + [sb] + [gl]> 3 &do
      CALC TYPE = 3
   &elseif &eq %<[pj] + [sb] + [gl]> 3 &do
      CALC TYPE = 4
   &else
      CALC TYPE = -9
   &end
   &r cursor master next
   &rv [i]
&end
&r cursor master remove

&rem **** calculate descriptions

ASEL
JOIN LUT.VEGC TYPE ORDERED
MOVE #TYPE_TXT TO TYPE_TXT
JOIN OFF

&return
Figure 2

EXAMPLE TWO: Faking Node Analysis

The optional nodepoint coverage generated by NBUILD may be used to simulate node analysis such as IDENTITY or NEAR. For example, to find all points in STATION2 within a 1k radius of a VEG node TYPE 1-4, use coverage VEG_NP generated in Example One. First, in ARCPLOTW, save a selection file of points representing nodes with TYPE values 1-4:

JOIN VEG_NP.PAT VEG.NAT VEG_
RES VEG_NP POINT #TYPE IN {1,2,3,4}
WIN SEL W VEG_NP POINT TEMP
Then, generate temporary coverage TEMP from the selection file, perform NEAR analysis, and join TEMP.PAT to STATION2.PAT to acquire the VEG_ attribute:

EXTRACT VEG_NP TEMP.SEL TEMP POINT
NEAR STATION2 TEMP POINT 1000
JOINITEM STATION2.PAT TEMP.PAT STATION2.PAT TEMP_ TEMP_
DROPITEM STATION2.PAT STATION2.PAT TEMP_
DROPITEM STATION2.PAT STATION2.PAT TEMP_ID
DELETE -NQ TEMP.*
The STATION.PAT will now join to VEG.NAT via VEG_:

STATION_ID      DISTANCE       #VEG_ #TYPE
307-01          863.7614          37  4
307-02          274.0641          37  4
307-04          952.4570          50  4
307-05          483.3828          49  4
307-07          227.3833          54  4
307-08          396.6482          54  4

Return to ArcTips page