/* ------------------------------------------------------------------------- /* GIS Laboratory /* Division of Geological and Planetary Sciences /* Caltech /* ------------------------------------------------------------------------- /* Program : TIGER_TO_GMT.AML /* Purpose : Read road arcs and names from the "tigerline" coverage and /* write the coordinates and name out to a file that can be read /* by the GMT program. /* ------------------------------------------------------------------------- /* Calls : extract /* Called by: none /* ------------------------------------------------------------------------- /* Arguments: none /* Globals : none /* ------------------------------------------------------------------------- /* Notes : This program writes arcs out to five files: /* primary.gmt (source: A11 to A18 and A21 to A28) /* secondary.gmt (source: A31 to A38) /* local.gmt (source: A41 to A48) /* dirt.gmt (source: A51 to A53) /* other_rds.gmt (source: A61 to A65 and A71 to A74) /* /* /* Tiger/Line File Census Feature Class Codes (CFCC) for Roads /* CFCC Description /* A11 Primary road with limited access or interstate highway, /* unseparated /* A12 Primary road with limited access or interstate highway, /* unseparated, in tunnel /* A13 Primary road with limited access or interstate highway, /* unseparated, underpassing /* A14 Primary road with limited access or interstate highway, /* unseparated, with rail line in center /* A15 Primary road with limited access or interstate highway, /* separated /* A16 Primary road with limited access or interstate highway, /* separated, in tunnel /* A17 Primary road with limited access or interstate highway, /* separated, underpassing /* A18 Primary road with limited access or interstate highway, /* separated, with rail line in center /* /* A21 Primary road with limited access, US highway, unseparated /* A22 Primary road with limited access, US highway, unseparated, /* in tunnel /* A23 Primary road with limited access, US highway, unseparated, /* underpassing /* A24 Primary road with limited access, US highway, unseparated, /* with rail line in center /* A25 Primary road with limited access, US highway, separated /* A26 Primary road with limited access, US highway, separated, /* in tunnel /* A27 Primary road with limited access, US highway, separated, /* underpassing /* A28 Primary road with limited access, US highway, separated, /* with rail line in center /* /* A31 Secondary and connecting road, state highway, unseparated /* A32 Secondary and connecting road, state highway, unseparated, /* in tunnel /* A33 Secondary and connecting road, state highway, unseparated, /* underpassing /* A34 Secondary and connecting road, state highway, unseparated, /* with rail line in center /* A35 Secondary and connecting road, state highway, separated /* A36 Secondary and connecting road, state highway, separated, /* in tunnel /* A37 Secondary and connecting road, state highway, separated, /* underpassing /* A38 Secondary and connecting road, state highway, separated, /* with rail line in center /* /* A41 Local, neighborhood, and rural road, city street, /* unseparated /* A42 Local, neighborhood, and rural road, city street, /* unseparated, in tunnel /* A43 Local, neighborhood, and rural road, city street, /* unseparated, underpassing /* A44 Local, neighborhood, and rural road, city street, /* unseparated, /* with rail line in center /* A45 Local, neighborhood, and rural road, city street, /* separated /* A46 Local, neighborhood, and rural road, city street, /* separated, in tunnel /* A47 Local, neighborhood, and rural road, city street, /* separated, underpassing /* A48 Local, neighborhood, and rural road, city street, /* separated, with rail line in center /* /* A51 Vehicular trail, road passable only by 4WD vehicle, /* unseparated /* A52 Vehicular trail, road passable only by 4WD vehicle, /* unseparated, in tunnel /* A53 Vehicular trail, road passable only by 4WD vehicle, /* unseparated, underpassing /* /* A61 Cul-de-sac /* A62 Traffic circle /* A63 Access ramp /* A64 Service drive /* A65 Ferry crossing /* /* A71 Walkway or trail for pedestrians /* A72 Stairway /* A73 Alley /* A74 Driveway or service road /* /* ------------------------------------------------------------------------- /* History : 02/23/98 - Tony Soeller; program created /* ========================================================================= /* &args /*. &s amlname = tiger_to_gmt.aml &severity &error &routine run_away /* Define the name of the Tiger coverage which contains the road arcs &s cov tigerline /* 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 "Primary Roads" &s file_name = primary &s file_name = prim_sub sel all /* resel cfcc cn 'A23' resel cfcc cn 'A11' asel cfcc cn (!'A12' 'A13' 'A14' 'A15' 'A16' 'A17' 'A18'!) asel cfcc cn (!'A21' 'A22' 'A23' 'A24' 'A25' 'A26' 'A27' 'A28'!) &call arc_extract /* Define the selection set for "Secondary Roads" &s file_name = secondary sel all resel cfcc cn 'A31' asel cfcc cn (!'A32' 'A33' 'A34' 'A35' 'A36' 'A37' 'A38'!) &call arc_extract /* Define the selection set for "Local Roads" &s file_name = local sel all resel cfcc cn 'A41' asel cfcc cn (!'A42' 'A43' 'A44' 'A45' 'A46' 'A47' 'A48'!) &call arc_extract /* Define the selection set for "Dirt Roads" &s file_name = dirt sel all resel cfcc cn 'A51' asel cfcc cn (!'A52' 'A53'!) &call arc_extract /* Define the selection set for "Other Roads" &s file_name = other_rds sel all resel cfcc cn 'A61' asel cfcc cn (!'A62' 'A63' 'A64' 'A65'!) asel cfcc cn (!'A71' 'A72' 'A73' 'A74'!) &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 &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 &s num_arcs = [show number select] &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 name = [show arc %rec_no% item fename] &s writestat = [write %fileunit% [quote > %name%]] /* 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%)