/* @(#) aml name: btsarc.aml /* @(#) /* @(#) created February through June 1996 /* @(#) modified February 2000 to allow for the FEATURID in the /* @(#) NHPN to properly load. The featurid has been modified to /* @(#) a ten length field. The STFIPS Code as the first two /* @(#) digits of the featurid was causing the reload process to /* @(#) quit because the value exceeded the maximum possible for /* @(#) an integer field. The network subroutine now will code /* @(#) the featurid as a numeric field with no decimal places /* /* @(#) modified in February 1999 - creating polygon coverages /* @(#) simplified. some of the stuff in the previous version /* @(#) may have worked, but in a convoluted way /* /* modifications through Feb. 1997 - basically additional /* comments added 's' to 'line' in generate command when HP user /* had the macro stop (line had to be plural in his ARC Version?) /* added the comment about only building the base files /* modification in Feb. 1997 changes the method in which some of the /* files are related. This change was required based on different /* methods in which some of the data was supplied to the BTS. /* by BTS staff /* @(#) /* @(#) this macro requires the use of the UNIX NTAD files /* if you have the DOS NTAD files, you can convert the DOS files /* to make them useable with this macro: use the UNIX translate (tr) /* command to remove the end-of-line character /* ex: tr -d '\012' < original_file_name > translated_file_name /* /* @(#) purpose: to take the BTS format ASCII dataset files from the /* @(#) National Transportation Atlas 1996 CD-ROM and load them /* @(#) into the appropriate coverage type in ARC/INFO /* @(#) /* @(#) the macro assumes that it is run from the directory /* @(#) where the cover is being built /* @(#) /* @(#) The user must have write permission in that directory /* @(#) /* @(#) additionally, the macro was developed with the assumption that /* @(#) the dataset files reside on the CD-ROM, thus, the requirement for /* @(#) the pathname argument /* @(#) /* @(#) The macro requires three arguments: /* @(#) 1) the source file prefix /* @(#) 2) the output cover prefix /* @(#) 3) the path where the source files exist /* @(#) /* @(#) example: &r btsarc county county /cdrom/polys/county/ /* @(#) /* @(#) This macro builds ONLY the BASE files. The attributes are /* @(#) unique for each dataset, so as of October 1996 we have not /* @(#) added the capability for the attributes here. /* @(#) The attributes are stored in both ASCII and dBASE format. /* @(#) The user can either DEFINE templates in INFO (or other database /* @(#) package such as ORACLE) and load the ASCII attributes into the /* @(#) template, or use the command DBASEINFO to import the dBase /* @(#) files into INFO. Any fields defined with a decimal may be /* @(#) altered in the dBase format. For example, where a field is /* @(#) originally defined as Numeric having a width of 7 and 2 decimal /* @(#) places, if the value does not completely fill the field, the /* @(#) file will store the value as left justified with additional /* @(#) zero-filled decimal places (ASCII original value = 12.56, dBase /* @(#) value = 12.5600). /* @(#) /* @(#) the macro uses the filename extensions to determine whether /* @(#) the dataset is point, line, or polygon - if you copy the files /* @(#) to a system directory, you must maintain the file name extensions /* /* the macro can read the source files directly from the CDROM /* any temporary files are created in the directory where /* the coverage is being built and deleted at the end /* of the macro /* /* Two awk scripts are included as subroutines within the aml: /* 1) to reformat the linear coordinate information for /* use in the ARC GENERATE command; and /* 2) to identify the FEATURID as a character or integer field /* /* We welcome any constructive criticism or suggestions for methods /* to improve this aml /* /* any user notes or errors identified in the datasets are posted /* on the BTS internet node (http://www.bts.gov). /* /* Please address any questions, comments, or concerns about this aml to: /* Carol Brandt, Spatial Database Manager, BTS /* email: carol.brandt@bts.gov /* &ARGS .in_file .cover .pathname /* &messages &on &severity &warning &fail &severity &error &fail /* precision double double /* /* check for arguments - if no arguments, return appropriate mesage /* &if [null %.in_file%] &then &return &warning usage: ~ btsarc /* &if [null %.cover%] &then &return &warning usage: ~ btsarc /* &if [null %.pathname%] &then &return &warning usage: ~ btsarc /* /* Check for the existence of the files for input /* &call begin_load /* &if [exists %.pathname% -directory] &then &do &do ext &list are &if [exists %.pathname%%.in_file%.%ext% -file] &then &do &if [exists %.pathname%%.in_file%.geo -file] &then &do &type \ \ Calling the make polygon subroutine \ \ &call mkpolys &end &end &else &do &type \ \ This is not a valid polygon dataset \ \ &end &end &do ext &list lnk &if [exists %.pathname%%.in_file%.%ext% -file] &then &do &if [exists %.pathname%%.in_file%.nod -file] &then &if [exists %.pathname%%.in_file%.geo -file] &then &do &type \ \ Calling the make network subroutine \ \ &call mknets &end &end &else &do &type \ \ This is not a valid network dataset \ \ &end &end &do ext &list pnt &if [exists %.pathname%%.in_file%.%ext% -file] &then &do &type \ \ Calling the make point subroutine \ \ &call mkpts &end &else &do &type \ \ This is not a valid point dataset \ \ &end &end &end &else &return &error The directory %.pathname% does not exist /* &return /* &return /* /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* /* Find Subroutines Here /* /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* /* subroutine begin /* /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* &routine begin_load /* &sys date &s start_time = [date -vfull] &type \ \ \ [quote Beginning Process to load %.in_file% files] \ \ \ /* &return /* /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* /* subroutine done /* /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* &routine done_load /* &sys date &s end_time = [date -vfull] &type \ \ \[quote Completed Process to load %.in_file% files] \ \ \ &type [quote Process started at %start_time%\ and completed at %end_time%] \ \ /* &return /* /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* /* subroutine read_geo_file /* /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* &routine read_geo_file /* &s rgf read_geo.awk &s out [open %rgf% stat -write] /* &s stat [write %out% '# '] &s stat [write %out% '# This awk script will read a geo file and '] &s stat [write %out% '# reformat it into Arc format '] &s stat [write %out% '# '] &s stat [write %out% '# The 'END' line will be printed before an ID '] &s stat [write %out% '# The 'start' variable makes sure an 'END' line '] &s stat [write %out% '# will not be printed at the beginning of '] &s stat [write %out% '# the output '] &s stat [write %out% '# '] &s stat [write %out% 'BEGIN { start = 0 } '] &s stat [write %out% '# a coordinate pairs line will not contained letter'] &s stat [write %out% '/[A-z]+/ { '] &s stat [write %out% ' if (start != 0) '] &s stat [write %out% '{ '] &s stat [write %out% ' print "END" '] &s stat [write %out% ' } '] &s stat [write %out% '# error if the first character is not 'G' '] &s stat [write %out% ' if ($0 !~ /^G.*/) '] &s stat [write %out% ' { '] &s stat [write %out% ' print "First letter of an ID line is not G, exiting..." '] &s stat [write %out% ' exit '] &s stat [write %out% ' } '] &s stat [write %out% ' uniqueid = substr($0, 14, 10) '] &s stat [write %out% '# print the unique ID '] &s stat [write %out% ' print uniqueid '] &s stat [write %out% ' start = 1 '] &s stat [write %out% ' } '] &s stat [write %out% '# a coordinate pair line contains only numbers, '] &s stat [write %out% '# period and minus sign '] &s stat [write %out% '/^[0-9 .-]+$/ { '] &s stat [write %out% '# extract the coordinate pairs '] &s stat [write %out% ' coorpr[1] = substr($0, 1, 10) '] &s stat [write %out% ' coorpr[2] = substr($0, 11, 10) '] &s stat [write %out% ' coorpr[3] = substr($0, 21, 10) '] &s stat [write %out% ' coorpr[4] = substr($0, 31, 10) '] &s stat [write %out% ' coorpr[5] = substr($0, 41, 10) '] &s stat [write %out% ' coorpr[6] = substr($0, 51, 10) '] &s stat [write %out% ' coorpr[7] = substr($0, 61, 10) '] &s stat [write %out% ' coorpr[8] = substr($0, 71, 10) '] &s stat [write %out% ' for (x = 1; x <= 8; x++) '] &s stat [write %out% '# find out number of pairs '] &s stat [write %out% ' { '] &s stat [write %out% ' if (coorpr[x] ~ /^ +$/ || coorpr[x] ~ /^$/) '] &s stat [write %out% '# an empty coordinate contains space only or null '] &s stat [write %out% ' { '] &s stat [write %out% ' numofcoor = x-1 '] &s stat [write %out% ' break '] &s stat [write %out% ' } '] &s stat [write %out% ' numofcoor = 8 '] &s stat [write %out% '# 8 coordinates if no empty data '] &s stat [write %out% ' } '] &s stat [write %out% '# print the coordinate with decimal point '] &s stat [write %out% ' for (x = 1; x <= numofcoor; x+=2) '] &s stat [write %out% ' { '] &s stat [write %out% ' printf (" %s.%s ", substr(coorpr[x],1,4), substr(coorpr[x],5,6)) '] &s stat [write %out% ' printf ("%s.%s\n", substr(coorpr[x+1],1,4), substr(coorpr[x+1],5,6)) '] &s stat [write %out% ' } '] &s stat [write %out% ' } '] &s stat [write %out% '# print the ending 'END' lines '] &s stat [write %out% 'END { print "END"; print "END" } '] &s stat [close %out%] &return /* /* this method to create an awk script from within aml is copied /* from a macro developed by Peter Girard, ESRI Boston, to convert /* NHPN files into ARC/INFO for the FHWA /* /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* /* subroutine char_int_featurid /* /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* &routine char_int_featurid /* &s cif char_int.awk &s iden [open %cif% stat2 -write] /* &s stat2 [write %iden% '# '] &s stat2 [write %iden% '# This awk script will read a file and identify if '] &s stat2 [write %iden% '# it has an integer ID or alphabet ID '] &s stat2 [write %iden% '# '] &s stat2 [write %iden% '# '] &s stat2 [write %iden% ' NR == 1 { '] &s stat2 [write %iden% ' ident = substr($0, 24, 1); '] &s stat2 [write %iden% ' if (ident ~ /[a-zA-Z0-9]/) '] &s stat2 [write %iden% ' { print "Non integer ID" } '] &s stat2 [write %iden% ' else '] &s stat2 [write %iden% ' { print "All integer ID" } '] &s stat2 [write %iden% ' exit '] &s stat2 [write %iden% '} '] &s stat2 [close %iden%] &return /* /* this routine was modified July 15, 1996 /* the original routine did not identify the FEATURID field /* as character in datasets where the field contents were /* numeric left-justified values /* the modification looks only at the first space of the /* FEATURID field. If a character exists in that one space /* the field is identified as character /* /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* /* subroutine mkpolys /* /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* &routine mkpolys /* /* this subroutine creates the polygon coverage /* /* Call Routine to extract the geographic coordinate information /* from the .geo file /* &type \ \ [quote Beginning to create coordinate file for GENERATE command] \ \ /* &call read_geo_file /* &sys awk -f read_geo.awk %.pathname%%.in_file%.geo > %.in_file%_ungen_line /* generate %.cover% input %.in_file%_ungen_line lines quit /* build %.cover% poly build %.cover% line /* /* redefine the internal polygon id (cover#) to match with the /* internal left and right line side fields (lpoly#, rpoly#) in the .aat /* /* the following line is required for INFO to recognize the variable as /* upper case /* &s .cover = [Translate %.cover%] /* &DATA ARC INFO ARC SEL %.cover%.PAT REDEFINE 9,LPOLY#,4,5,B 9,RPOLY#,4,5,B Q STOP &END /* /* /* call the awk script to determine whether the dataset has a /* character or integer featurid /* &type \ \ [quote determining whether the FEATURID is character or integer] \ \ /* &call char_int_featurid /* &sys awk -f char_int.awk %.pathname%%.in_file%.are > which /* /* remove the new line character from the ASCII files to load them /* into INFO templates and grep extracts the minimal non-spatial /* information from the .geo file /* &sys tr -d '\012' < %.pathname%%.in_file%.are > %.in_file%.are_tr &sys grep 'G' %.pathname%%.in_file%.geo > %.in_file%.geo_grep &sys tr -d '\012' < %.in_file%.geo_grep > %.in_file%.geo_tr /* /* Define templates for the .are and .geo files /* the .geo file is modified in statements above to create two separate files - /* one file is created in the ARC ungenerate format to load into ARC using the /* GENERATE command (above) /* the second file only contains the non-spatial information from the .geo file /* &s fileunit = [open which opstat -read] &s record = [read %fileunit% rdstat] &s opstat [close %fileunit%] /* &if %record% = [quote All integer ID] &then &do &type \ \ Polygon FEATURID is Integer \ \ &type Defining INFO templates \ \ &DATA ARC INFO ARC CALC $COMMA-SWITCH = -1 CALC $PRINTER-SIZE = 200 DEFINE %.cover%.AREA ARECTYPE,1,1,C AVERSION,2,2,C AREVISION,2,2,C AMODDATE,8,8,I POLYID,10,10,I FEATURID,10,10,I CNTRLONG,10,10,I CNTRLAT,10,10,I DESCRIPT,35,35,C STFIPS,2,2,C SEL %.cover%.AREA GET ../%.in_file%.are_tr COPY Q STOP &END &end &else /* &do &type \ \ Polygon FEATURID is Character \ \ &type Defining INFO templates \ \ &DATA ARC INFO ARC CALC $COMMA-SWITCH = -1 CALC $PRINTER-SIZE = 200 DEFINE %.cover%.AREA ARECTYPE,1,1,C AVERSION,2,2,C AREVISION,2,2,C AMODDATE,8,8,I POLYID,10,10,I FEATURID,10,10,C CNTRLONG,10,10,I CNTRLAT,10,10,I DESCRIPT,35,35,C STFIPS,2,2,C SEL %.cover%.AREA GET ../%.in_file%.are_tr COPY Q STOP &END &end &type \ \ Creating polygon label points \ \ /* additem %.cover%.AREA %.cover%.AREA c_long_d 11 11 n 6 additem %.cover%.AREA %.cover%.AREA c_lat_d 10 10 n 6 &DATA ARC INFO ARC CALC $COMMA-SWITCH = -1 CALC $PRINTER-SIZE = 200 SEL %.cover%.AREA CALC C_LONG_D = CNTRLONG / 1000000 CALC C_LAT_D = CNTRLAT / 1000000 SEL %.cover%.AREA OUTPUT ../%.cover%.lbl_pts INIT PRINT POLYID, C_LONG_D, C_LAT_D PRINT 'END' OUTPUT XXXNSP Q STOP &END generate %.cover% input %.cover%.lbl_pts points quit build %.cover% poly /* additem polyid for the pat and linkid for the aat additem %.cover%.pat %.cover%.pat polyid 10 10 i # %.cover%-id additem %.cover%.aat %.cover%.aat linkid 10 10 i # %.cover%-id &DATA ARC INFO ARC CALC $COMMA-SWITCH = -1 CALC $PRINTER-SIZE = 200 SEL %.cover%.PAT CALC POLYID = %.cover%-ID SEL %.cover%.AAT CALC LINKID = %.cover%-ID ALTER LINKID,,,,,LINEID,,,,,, DEFINE %.cover%.NO_GEO GRECTYPE,1,1,C GVERSION,2,2,C GREVISION,2,2,C GMODDATE,8,8,I LINKID,10,10,I POLYIDL,10,10,I POLYIDR,10,10,I NPOINT,3,3,I SEL %.cover%.NO_GEO GET ../%.in_file%.geo_tr COPY SEL %.cover%.AREA SORT ON POLYID SEL %.cover%.NO_GEO SORT ON LINKID Q STOP &END joinitem %.cover%.aat %.cover%.no_geo %.cover%.aat linkid linkid ordered joinitem %.cover%.pat %.cover%.area %.cover%.pat polyid polyid ordered /* /* set the variable back to lower case so that the files created in this /* load process can be deleted /* &set .cover = [locase %.cover%] /* &type \ \ Cleaning Up \ &type Removing temporary files created \ \ /* &sys rm %.in_file%.are_tr &sys rm %.in_file%.geo_grep &sys rm %.in_file%.geo_tr &sys rm %.in_file%_ungen_line &sys rm %.cover%.lbl_pts &sys rm read_geo.awk &sys rm which &sys rm char_int.awk /* &call done_load /* &return /* /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* /* subroutine mknets /* /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* &routine mknets /* /* this subroutine creates the network coverages /* /* Call Routine to extract the geographic coordinate information /* from the .geo file /* &type \ \ Creating Coordinate file for GENERATE command \ \ /* &call read_geo_file /* &sys awk -f read_geo.awk %.pathname%%.in_file%.geo > %.in_file%_ungen_line /* /* make sure the files for input to INFO have no carriage return /* character /* &sys tr -d '\012' < %.pathname%%.in_file%.lnk > %.in_file%.lnk_tr &sys tr -d '\012' < %.pathname%%.in_file%.nod > %.in_file%.nod_tr &sys grep 'G' %.pathname%%.in_file%.geo > %.in_file%.geo_grep &sys tr -d '\012' < %.in_file%.geo_grep > %.in_file%.geo_tr /* /* define the node file first to allow for creation of a point cover /* call the awk script to determine whether the node FEATURID is /* character or integer /* &call char_int_featurid &sys rm which &sys awk -f char_int.awk %.pathname%%.in_file%.nod > which /* /* &s fileunit = [open which opstat -read] &s record = [read %fileunit% rdstat] &s opstat [close %fileunit%] /* &s .cover = [Translate %.cover%] /* &if %record% = [quote All integer ID] &then &do &type \ \ Network Node FEATURID is Integer \ \ &DATA ARC INFO ARC CALC $COMMA-SWITCH = -1 CALC $PRINTER-SIZE = 200 DEFINE %.cover%.NODE NRECTYPE,1,1,C NVERSION,2,2,C NREVISION,2,2,C NMODDATE,8,8,I NODEID,10,10,I FEATURID,10,10,N,0 LONGITUD,10,10,I LATITUDE,10,10,I DESCRIPT,35,35,C STFIPS,2,2,C SEL %.cover%.NODE GET ../%.in_file%.nod_tr COPY Q STOP &END &end &else /* &do &type \ \ Network Node FEATURID is Character \ \ &DATA ARC INFO ARC CALC $COMMA-SWITCH = -1 CALC $PRINTER-SIZE = 200 DEFINE %.cover%.NODE NRECTYPE,1,1,C NVERSION,2,2,C NREVISION,2,2,C NMODDATE,8,8,N,0 NODEID,10,10,I FEATURID,10,10,C LONGITUD,10,10,I LATITUDE,10,10,I DESCRIPT,35,35,C STFIPS,2,2,C SEL %.cover%.NODE GET ../%.in_file%.nod_tr COPY Q STOP &END &end /* create a system file contining the nodeid and coordinate values /* first get decimal values for the longitude and latitude /* additem %.cover%.node %.cover%.node long_dec 11 11 n 6 stfips additem %.cover%.node %.cover%.node lat_dec 10 10 n 6 long_dec /* &DATA ARC INFO ARC CALC $COMMA-SWITCH = -1 CALC $PRINTER-SIZE = 200 SEL %.cover%.NODE REM SORT ON NODEID REM CALC LONG_DEC = LONGITUD / 1000000 CALC LAT_DEC = LATITUDE / 1000000 REM OUTPUT ../%.in_file%_node_point INIT PRINT NODEID, LONG_DEC, LAT_DEC PRINT 'END' OUTPUT XXXNSP Q STOP &END generate %.cover% input %.in_file%_ungen_line line input %.in_file%_node_point points quit /* build %.cover% line build %.cover% node build %.cover% point /* additem %.cover%.aat %.cover%.aat linkid 10 10 I # %.cover%-id additem %.cover%.nat %.cover%.nat nodeid 10 10 I # %.cover%-id additem %.cover%.pat %.cover%.pat nodeid 10 10 I # %.cover%-id /* /* call the awk script to determine whether the dataset has a /* character or integer link FEATURID /* &call char_int_featurid /* &sys rm which &sys awk -f char_int.awk %.pathname%%.in_file%.lnk > which /* &set .cover = [Translate %.cover%] /* /* define the .LINK, and .NO_GEO files in INFO /* each will be joined to the appropriate cover /* /* the .geo file is modified in statements above to create two separate files - /* one file is created in the ARC ungenerate format to load into ARC using the /* GENERATE command (above) /* the second file only contains the non-spatial information from the .geo file /* /* &s fileunit = [open which opstat -read] &s record = [read %fileunit% rdstat] &s opstat [close %fileunit%] /* &if %record% = [quote All integer ID] &then &do &type \ \ Network link FEATURID is Integer \ \ &type Defining INFO templates \ \ /* &DATA ARC INFO ARC CALC $COMMA-SWITCH = -1 CALC $PRINTER-SIZE = 200 SEL %.cover%.AAT CALC LINKID = %.cover%-ID DEFINE %.cover%.LINK LRECTYPE,1,1,C LVERSION,2,2,C LREVISION,2,2,C LMODDATE,8,8,I LINKID,10,10,I FEATURID,10,10,N,0 ANODE,10,10,I BNODE,10,10,I DESCRIPT,35,35,C STFIPS1,2,2,C STFIPS2,2,2,C REM SEL %.cover%.LINK GET ../%.in_file%.lnk_tr COPY SEL %.cover%.LINK SORT ON LINKID Q STOP &END &end &else /* &do &type \ \ Network Link FEATURID is Character \ \ &type Defining INFO templates \ \ /* &DATA ARC INFO ARC CALC $COMMA-SWITCH = -1 CALC $PRINTER-SIZE = 200 SEL %.cover%.AAT CALC LINKID = %.cover%-ID DEFINE %.cover%.LINK LRECTYPE,1,1,C LVERSION,2,2,C LREVISION,2,2,C LMODDATE,8,8,I LINKID,10,10,I FEATURID,10,10,C ANODE,10,10,I BNODE,10,10,I DESCRIPT,35,35,C STFIPS1,2,2,C STFIPS2,2,2,C REM SEL %.cover%.LINK GET ../%.in_file%.lnk_tr COPY SEL %.cover%.LINK SORT ON LINKID Q STOP &END &end /* &DATA ARC INFO ARC CALC $COMMA-SWITCH = -1 CALC $PRINTER-SIZE = 200 SEL %.cover%.PAT CALC NODEID = %.cover%-ID Q STOP &END /* joinitem %.cover%.aat %.cover%.link %.cover%.aat linkid linkid ordered joinitem %.cover%.pat %.cover%.node %.cover%.pat nodeid nodeid ordered /* &DATA ARC INFO ARC CALC $COMMA-SWITCH = -1 CALC $PRINTER-SIZE = 200 DEFINE %.cover%.NO_GEO GRECTYPE,1,1,C GVERSION,2,2,C GREVISION,2,2,C GMODDATE,8,8,I LINKID,10,10,I BLANK,20,20,C NPOINT,3,3,I SEL %.cover%.NO_GEO GET ../%.in_file%.geo_tr COPY SEL %.cover%.NO_GEO SORT ON LINKID Q STOP &END /* joinitem %.cover%.nat %.cover%.node %.cover%.nat nodeid nodeid ordered /* /* pointnode %.cover% %.cover% 0.000005 /* build %.cover% line build %.cover% node /* &set .cover = [locase %.cover%] /* &type \ \ Cleaning Up \ \ &type Removing temporary files \ \ /* &sys rm %.in_file%.lnk_tr &sys rm %.in_file%.nod_tr &sys rm %.in_file%.geo_grep &sys rm %.in_file%.geo_tr &sys rm %.in_file%_ungen_line &sys rm %.in_file%_node_point &sys rm read_geo.awk &sys rm which &sys rm char_int.awk /* &call done_load /* &return /* /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* /* subroutine mkpts /* /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* &routine mkpts /* &type \ \ Determining whether FEATURID is character or integer \ \ /* &call char_int_featurid /* &sys awk -f char_int.awk %.pathname%%.in_file%.pnt > which /* &sys tr -d '\012' < %.pathname%%.in_file%.pnt > %.in_file%.pnt_tr /* &set .cover = [Translate %.cover%] /* &s fileunit = [open which opstat -read] &s record = [read %fileunit% rdstat] &s opstat [close %fileunit%] /* &if %record% = [quote All integer ID] &then &do &type \ \ Point FEATURID is integer \ \ &type Defining INFO templates \ \ /* &DATA ARC INFO ARC CALC $COMMA-SWITCH = -1 CALC $PRINTER-SIZE = 200 DEFINE %.cover%.POINT RECTYPE,1,1,C VERSION,2,2,C REVISION,2,2,C MODDATE,8,8,I POINTID,10,10,I FEATURID,10,10,I LONGITUD,10,10,I LATITUDE,10,10,I DESCRIPT,35,35,C STFIPS,2,2,C REM SEL %.cover%.POINT GET ../%.in_file%.pnt_tr COPY Q STOP &END &end &else /* &do &type \ \ Point FEATURID is character \ \ &type Defining INFO templates \ \ /* &DATA ARC INFO ARC CALC $COMMA-SWITCH = -1 CALC $PRINTER-SIZE = 200 DEFINE %.cover%.POINT RECTYPE,1,1,C VERSION,2,2,C REVISION,2,2,C MODDATE,8,8,I POINTID,10,10,I FEATURID,10,10,C LONGITUD,10,10,I LATITUDE,10,10,I DESCRIPT,35,35,C STFIPS,2,2,C REM SEL %.cover%.POINT GET ../%.in_file%.pnt_tr COPY Q STOP &END &end /* add decimal longitude and latitude fields to the .POINT INFO file /* then, CALC the integer longitude and latitude fields to create the decimal values /* output the decimal values plus the unique point-id and generate a point coverage /* additem %.cover%.point %.cover%.point long_dec 11 11 n 6 stfips additem %.cover%.point %.cover%.point lat_dec 10 10 n 6 long_dec &DATA ARC INFO ARC CALC $COMMA-SWITCH = -1 CALC $PRINTER-SIZE = 200 SEL %.cover%.POINT CALC LONG_DEC = LONGITUD / 1000000 CALC LAT_DEC = LATITUDE / 1000000 OUTPUT ../%.cover%_input INIT PRINT 5T, POINTID, 20T, LONG_DEC, 40T, LAT_DEC PRINT 10T, 'END' OUTPUT XXXNSP Q STOP &END generate %.cover% input %.cover%_input point quit build %.cover% point additem %.cover%.pat %.cover%.pat pointid 10 10 i # %.cover%-id &DATA ARC INFO ARC SEL %.cover%.PAT CALC POINTID = %.cover%-ID SEL %.cover%.POINT SORT ON POINTID Q STOP &END joinitem %.cover%.pat %.cover%.point %.cover%.pat pointid pointid ordered build %.cover% point /* &set .cover = [locase %.cover%] /* &type \ \ Cleaning Up \ \ &type Removing temporary files \ \ /* &sys rm %.in_file%.pnt_tr &sys rm %.cover%_input &sys rm which &sys rm char_int.awk /* &call done_load /* &return