/* ------------------------------------------------------------------------- /* GIS Laboratory /* Division of Geological and Planetary Sciences /* Caltech /* ------------------------------------------------------------------------- /* Program : DLG-HY-COV_TO_GMT.AML /* Purpose : Read hydrology arcs and attributes from the DLG coverage and /* write the coordinates of specific hydrologic features out to /* a series of files that can be read by GMT. /* ------------------------------------------------------------------------- /* Calls : none /* Called by: none /* ------------------------------------------------------------------------- /* Arguments: cov - the name of the DLG coverage which contains the /* hydro arcs /* Globals : none /* ------------------------------------------------------------------------- /* Notes : This program writes arcs out to these files: /* dlg_shore.xy (source: Minor1 200) /* dlg_str.xy (source: Minor1 401, 412) /* dlg_aqua.xy (source: Minor1 415) /* /* DLG Class Codes for Hydrology /* Major1 Minor1 Major2 Minor2 Description /* 50 200 Shoreline /* 50 200 50 610 Shoreline, intermittent /* 50 201 Shoreline, manmade /* 50 201 50 406 Shoreline, Dam or weir /* 50 204 Apparent limit /* 50 401 Falls /* 50 406 Dam or weir /* 50 406 50 201 Dam or weir, shoreline /* 50 408 Spillway /* 50 412 Stream /* 50 412 50 202 Stream, closure line /* 50 412 50 610 Stream, intermittent /* 50 412 59 9 Stream, coincident feature /* 50 414 Ditch or canal /* 50 414 50 610 Ditch or canal, intermittent /* 50 415 50 601 Aqueduct, underground /* 50 415 59 17 Aqueduct, coincident feature /* 50 417 Penstock /* 50 601 50 415 Underground, aqueduct /* 50 610 50 412 Intermittent, stream /* /* /* ------------------------------------------------------------------------- /* History : 04/07/98 - Tony Soeller; program created /* ========================================================================= &args cov /*. &s amlname = dlg_to_gmt.aml &severity &error &routine run_away &if [null %cov%] &then &return &inform Usage: &r dlg-hy-cov_to_gmt /* Set up environment &if [show program] ne ARCEDIT &then ARCEDIT &if ^ [exists %cov% -cover] &then &do &type Coverage %cov% does not exist. Terminating... &return &end editc %cov% ef arc /* Define the selection set for "Streams" &s file_name = dlg_str sel all resel major1 = 50 and minor1 = 412 and major2 = -99999 and minor2 = -99999 &call arc_extract /* Define the selection set for "Streams, intermittent" &s file_name = dlg_stri sel all resel major1 = 50 and minor1 = 412 and major2 = 50 and minor2 = 610 &call arc_extract /* Define the selection set for "Shoreline" &s file_name = dlg_shor sel all resel major1 = 50 and minor1 = 200 and major2 = -99999 and minor2 = -99999 &call arc_extract /* Define the selection set for "Underground aquaduct" &s file_name = dlg_aqu sel all resel major1 = 50 and minor1 = 415 and major2 = 50 and minor2 = 601 asel major1 = 50 and minor1 = 601 and major2 = 50 and minor2 = 415 &call arc_extract quit &return /************************************************************************ /* Routine ARC_EXTRACT /************************************************************************ /* Extract the data for each of the arcs in the selected set &routine arc_extract /* Open the GMT file and verify openness &s outfile = %file_name%.xy &if [exists %outfile% -file] &then &do &ty GMT file %outfile% already exists. &goto base &end &s num_arcs = [show number select] &if %num_arcs% = 0 &then &do &ty No records to process for %outfile%. &goto base &end &ty Writing coordinates to %outfile% ... &s fileunit = [open %outfile% status -w] &if %status% ne 0 &then &do &ty Could not open file %outfile%. &goto base &end &do arc_num = 1 &to %num_arcs% /*&type Processing arc %arc_num% of %num_arcs% /* Write out the name of the road (if any exists) &s rec_no = [show select %arc_num%] &s writestat = [write %fileunit% [quote > ]] /* Extract the vertex locations and write them out &s npnts = [show arc %rec_no% npnts] &do vert_num = 1 &to %npnts% &s coord = [show arc %rec_no% vertex %vert_num%] &s x = [extract 1 %coord%] &s y = [extract 2 %coord%] &s writestat = [write %fileunit% [quote %x% %y%]] &end &end /* end of arc_num loop &s status = [close %fileunit%] &label base &return /**************************************************************************** &routine run_away &s .error_flag 1 &s ok [close -all] &return &inform Error condition in routine (%amlname%)