/* This version uses an external java program instead of tables. /* The input covers should have binary values. /* Given coverages of contour lines and rivers, /* we want river slope, which incorporates an elevation for river /* junctions dervied by interpolating elevation along the main stem. /* vertical and xy dimensions may not match, but zfactor makes slope correct /* Before running this aml: /* Run flipper.aml to create the arc/node cover wholerivs. /* check the variables set below this constant. /* This aml creates splitrivs and rivspots. /* It creates and deletes splitconts, tmpcover, and tmpcover2. /* Note the constants which are set in the next few lines. /* This is base don topgrida.aml, Version 2.02, but it has /* total distrust of DEM. When node elevations cannot be /* interpolated, extrapolated slope of connecting segments. /* Do not even think about building a DEM. /* The one [?] reaining flaw: if you have a dangling source/outlet with a /* junction, and if the less preferred search path (lower shreve or /* dangling rather than hitting a contour) is actually the longer path, /* The extrapolation from a contour through a junction to the end can /* exceed the contour interval &args netcov /*****&set netcov wholerivs submit off &set concov clipcont &set elv_item elv /***********DXF-ELEVATION &set interval 40 /* intervals on contour files &set maxdangle 2 &set zfactor .3048 /************** 1 &TYPE streamslope.aml, Version 2.0 Fri Nov 15 17:28:10 PST 1996 &type Using the following constants:\concov %concov%\netcov %netcov%\elv_item %elv_item%\interval %interval%\maxdangle %maxdangle%\zfactor %zfactor% &if [exist splitrivs -cover] or [exist rivspots -cover] &then ;~ &return The covers splitrivs and rivspots must be deleted for this to run. &if [exist splitconts -cover] or [exist tmpcover -cover] or [exist tmpcover2 -cover] &then ;~ &return The covers splitconts, tmpcover, and tmpcover2 must be deleted for this to run. &if ^ [exist %concov% -cover] &then ;~ &return The coverage %concov% does not exist here. &if ^ [exist %netcov% -cover] &then ;~ &return The coverage %netcov% does not exist here. &if ^ [iteminfo %concov% -ARC JORDER -exists] &then ;~ additem %concov%.aat %concov%.aat JORDER 2 4 B &if ^ [iteminfo %concov% -ARC SHREVE -exists] &then ;~ additem %concov%.aat %concov%.aat SHREVE 2 4 B &if ^ [iteminfo %concov% -ARC STRAHLER -exists] &then ;~ additem %concov%.aat %concov%.aat STRAHLER 2 4 B &if ^ [iteminfo %concov% -ARC TLENGTH -exists] &then ;~ additem %concov%.aat %concov%.aat TLENGTH 4 12 F &if ^ [iteminfo %netcov% -ARC %elv_item% -exists] &then ;~ additem %netcov%.aat %netcov%.aat %elv_item% 4 4 i arcedit ec %netcov%;ef arc;sel all;put tmpcover ec %concov%;ef arc;sel all;put tmpcover;yes quit clean tmpcover tmpcover2 %maxdangle% .001 line kill tmpcover Arcedit ec tmpcover2 ef arc sel strahler eq 0 put splitconts &ty selecting river segments nselect calc tmpcover2-id = tmpcover2# put splitrivs QUIT n &type The coverages splitrivs and splitconts have been created. /* going to the use of NEAR instead of tracking topology dropitem splitrivs.aat splitrivs.aat elv renode splitrivs nodepoint splitrivs rivspots near rivspots splitconts line .001 /* now we have to go back to topology INDEXITEM splitconts.aat splitconts# INDEXITEM rivspots.pat splitconts# INDEXITEM splitrivs.aat FNODE# INDEXITEM splitrivs.aat TNODE# INDEXITEM rivspots.pat RIVSPOTS# /* These are all the relates for this aml relate add scont; splitconts.aat;INFO;splitconts#;splitconts#;linear;ro topt; rivspots.pat; INFO;TNODE#; RIVSPOTS#; linear;ro frompt; rivspots.pat; INFO;FNODE#; RIVSPOTS#; linear;ro [unquote ''] tables additem rivspots.pat elv 4 12 F 3 sel rivspots.pat calc elv = -99 resel scont//%elv_item% ge 0 /* otherwise we lose the -99 calc elv = scont//%elv_item% &if ^ [iteminfo splitrivs -ARC elvf -exists] &then additem splitrivs.aat elvf 4 10 f 3 &if ^ [iteminfo splitrivs -ARC elvt -exists] &then additem splitrivs.aat elvt 4 10 f 3 &if ^ [iteminfo splitrivs -ARC dz -exists] &then additem splitrivs.aat dz 4 10 f 3 &if ^ [iteminfo splitrivs -ARC slope -exists] &then additem splitrivs.aat slope 4 10 f 3 sel splitrivs.aat calc elvf = -99 calc elvt = -99 resel frompt//elv ge 0 calc elvf = frompt//elv asel resel topt//elv ge 0 calc elvt = topt//elv sel splitrivs.aat /* This works right in arcedit, but not tables. /*calc splitrivs-id = splitrivs# /* why not do it in java? save arcdata init &sys java Aslop >! javout purge; y get results /* Wait a minute: The save file "arcdata" is just a copy of splitrivs/aat.adf, /* depending on naming conventions. Aslop should be modified to read and /* write to this file. quit /* tables kill tmpcover2 kill splitconts