APPENDIX 8 ARROWMAP2.AML /* ****************************************************************** /* PROGRAM FOR MAKING REGIONS FROM THE ARROW MAP /* PREPARED BY AVRAM PRIMACK /* October, 1998 /* *************************************************************** &args nam &s numit = 1 &if [ iteminfo %nam% -poly checker -exists ] &then &goto skip1 additem %nam%.pat %nam%.pat checker 4 5 b &label skip1 /* collect the number of watersheds to process ae edit %nam% editf poly sel all calc %nam%-id = %nam%# calc checker = 0 &sv totnum = [ show number selected ] + 1 save q &do k = 2 &to %totnum% &type %k% out of %totnum% watersheds completed &type %k% out of %totnum% watersheds completed &type %k% out of %totnum% watersheds completed &type %k% out of %totnum% watersheds completed &if [ exists log -file ] &then &sys del log ae edit %nam% editf poly sel checker <> 0 &if [ show number selected ] > 0 &then calc checker = 0 sel %nam%-id = %k% calc checker = 1 /* COLLECT THE POLYGON ID FOR THE STARTING WATERSHED cursor open &sv flowto = %:edit.FLOWTO#% &sv thisnum = %:edit.THIS#% &sv pond = %:edit.POND% &sv class = %:edit.class% cursor close /* ADD TO THE SELECTION THE WATERSHEDS THAT FLOW INTO THE SELECTED ONE asel flowto# = %thisnum% /* LOOP FOR CLIMBING UP THE WATERSHED USING THE SELECTED SET AND CURSOR &label loopstart /* LOOP STARTS HERE &sv setsel = [show number selected] /* COLLECT ALL THE ID NUMBERS FOR THE COLLECTED POLYGONS cursor open &do kntr = 1 &to %setsel% &by 1 &sv thisnum%kntr% = %:edit.this#% cursor next &end cursor close /* ADD MORE WATERSHEDS TO THE SELECTED SET &do kntr = 1 &to %setsel% &by 1 asel flowto# = [value thisnum%kntr%] &end &if %setsel% ge [show number selected] &then &goto finadd unsel checker = 1 calc checker = 1 &goto loopstart &label finadd &type DONE SELECTING !!!!!!!!!!!!!!!!!!!!!! for watershed %k% &type DONE SELECTING !!!!!!!!!!!!!!!!!!!!!! for watershed %k% &type DONE SELECTING !!!!!!!!!!!!!!!!!!!!!! for watershed %k% &type DONE SELECTING !!!!!!!!!!!!!!!!!!!!!! for watershed %k% calc checker = 1 sel checker = 1 &type checker = 1 for [show number selected] polygons &sv numsubs = [ show number selected ] save q /* arcedit regionquery %nam% # wshed res checker = 1 ~ n n ae edit %nam% editf region.wshed &if %numit% > 1 &then &goto skipadd additem this# 4 5 b additem flowto# 4 5 b additem pond 8 8 c additem class 5 5 c additem nsubs 4 5 b &sv numit = 9 &label skipadd &sv klas = %k% - 1 sel wshed-id = %klas% calc pond = [quote %pond% ] calc class = [quote %class% ] calc this# = %thisnum% calc flowto# = %flowto% calc nsubs = %numsubs% save q &end /* &do &while &return