APPENDIX 8 ARROWSTART.AML /******************************************************************** /* AML for watershed flow direction assignment /* This AML is intended to assign watershed flow direction /* Prepared by Avram Primack 8/97 for the Upper Hudson Project /* /******************************************************************** &s nam [response 'Name of the coverage to work on'] /*////////////////////////////////////////////////////// /* kill old working file /*////////////////////////////////////////////////////// /*&if [exists %nam% -cover] &then kill %nam% /*///////////////////////////////////////////////////// /* copy main file to working file /*///////////////////////////////////////////////////// copy %nam% working /*///////////////////////////////////////////////////// /* check for the presence of working items in the .PAT /*///////////////////////////////////////////////////// &if [iteminfo working -polygon regionstate -exists] &then &goto skipadd1 &else additem working.pat working.pat regionstate 4 5 b &label skipadd1 &if [iteminfo working -polygon flowto# -exists] &then &goto skipadd2 &else additem working.pat working.pat flowto# 4 5 b &label skipadd2 &if [iteminfo working -polygon this# -exists] &then &goto skipadd3 &else additem working.pat working.pat this# 4 5 b ae edit working editf poly sel all calc flowto# = -9999 calc this# = working-id save quit &label skipadd3 /*///////////////////////////////////////////////////// /* set up the edit session /*///////////////////////////////////////////////////// ae display 9999 2 mape working edit working editf poly drawe poly region.watershed /* DAN CHANGE THIS LINE FOR HYDROGRAPHY /* ap $ARCHOME/atool/arcplot/hyddraw draw /*/////////////////////////////////////////////// /* STARTING EDITING LOOP NOW///////////////////// /*/////////////////////////////////////////////// &label morework &DO &WHILE [query 'Do another? (y or n)'] &type THESE POLYGONS HAVE NO FLOWTO NUMBER ASSIGNED sel FLOWTO# = -9999 setdrawsymbol 0 2 drawsel &pause /* COLLECT THE this# FOR THE FLOWTO POLYGON &type 'SELECT THE FLOW TO POLYGON NOW' sel cursor open &type cursor open &sv flowto = %:edit.this#% &type 'Flowto polygon numbers' &type THIS# FLOWTO# list THIS# FLOWTO# cursor close /* SELECT THE POLYGON TO ATTACH THE this# NUMBER TO &type 'Select the flow from polygon now' sel cursor open &sv thispoly = %:edit.flowto#% cursor close &if %thispoly% ne -9999 &then /* &do &if [query 'REALLY CHANGE THIS FLOWTO#??? (y to change, n to leave)'] &then &goto calcnumber &else &goto morework /* &end &label calcnumber &type 'Flow from (this#) polygon numbers' list THIS# FLOWTO# calc flowto# = %flowto% list THIS# FLOWTO# cursor open &sv receiving# = %:edit.this#% cursor close /*///////////////////////////////////////////////////// /* LOCAL CHECK///////////////////////////////////////// /*///////////////////////////////////////////////////// sel this# = %flowto% sds 0 3 sel this# = %receiving#% sds 0 4 sel this# = %receiving#% asel this# = %flowto% &type THIS# FLOWTO# list THIS# FLOWTO# &type &sv keeper [response 'Keep this? (y or n)'] &type &if %keeper% ne y &then oops /* &type Deleting last entry!!!!!! /*/////////////////////////////////////////////////////// /* ENDING EDITING LOOP NOW ////////////////////////////// &END /*/////////////////////////////////////////////////////// save &if [query 'Continue? (y or n)'] &then &goto morework quit /* from arcedit y y /* SAVES CHANGES IN THE TEMPORARY EDITING COVERAGE /*///////////////////////////////////////////////////// /* SAVES THE SESSION RESULTS /*///////////////////////////////////////////////////// &label reallysave &sv sav [response 'Save this session? (y or n)'] &if %sav% = 'y' &then &do kill %nam% &type RENAMED WORKING COPY TO MAIN COPY rename working %nam% &end &else &DO &if %sav% = 'n' &then kill working &else &do &if [query 'Really abandon current work?? (y or n)'] &then kill working &else &goto reallysave &end &END /* &type WARNING LEAVING ARCEDIT WITHOUT SAVING CURRENT WORK /*/////////////////////////////////////////// /* leave program /*//////////////////////////////////////////// &return /* to arc level prompt