Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ll-xn!cit-vax!mangler From: mangler@cit-vax.Caltech.Edu (System Mangler) Newsgroups: net.news.adm Subject: Re: Useful #L entries in uucp map (was "Re: a foolish consistency...") Message-ID: <940@cit-vax.Caltech.Edu> Date: Sun, 31-Aug-86 06:10:11 EDT Article-I.D.: cit-vax.940 Posted: Sun Aug 31 06:10:11 1986 Date-Received: Sun, 31-Aug-86 09:01:33 EDT References: <5048@decwrl.DEC.COM> <15454@ucbvax.BERKELEY.EDU> <432@epimass.UUCP> <339@maynard.UUCP> Organization: California Institute of Technology Lines: 82 Keywords: uucp map graph(1G) awk source Summary: #L parser in awk Here is the awk script I use to plot #L entries from the UUCP map. It produces output suitable for graph(1G). Sites at the same latitude/longitude are listed in the same label (which produces absurdly long labels for the New Jersey map, so I arbitrarily truncate the label to 50 characters). It correctly parses the following "imaginative" entries from the map: #L 35 46 38.219 N, 139 36 52.833 E #L 79'25W / 43'45N city #L 107 W/52 N #L 48.13972 N 11.57444 E #L 45dg 12' N, 05dg 46' E #L 2 21'24" E /48 52'01"N #L 02 21' 24'' East / 48 52' 01'' North #L [59.33N 18.09E] #L 37.2 N / 122 W(approx), Santa Clara(CLose to San Francisco) #L 37deg 52' 28" North x 122deg 15' 44" West #L 37o 12' 13" N, 122o 10' 49" W #L Lat 44 deg. 59.0' N, Long 93 deg. 15.8' W #L 42' 58'' N / 78' 48'' W (city) It interprets period as a decimal point, which causes incorrect results on these: #L approx. 33.30'N, 117W #L 52.16'40"N 10.32'30"E #L 49.15:20N 7.2:30E It requires N, E, S, W to terminate the numbers, and separators between degrees/minutes/seconds, so it produces no output for these: #L N43'04"13.658 W89'24"23.156 Elevation246.81meters Stdv<10meters #L 122/37 30' #L 472240N / 083330E #L Lat 36 deg 08 min, Long 80 deg 15 min #L Lat 37 27' 35", Lon 122 5' 0" #L longitude/latitude (har ingen aning, hoppad Du har !) [have no idea, hope you have !] A month ago some of the European maps were filled with entries of the form "N 1 23 E 4 56", but some hardworking soul has fixed them all. Thanks, whoever you are! (Mel?) Awk script follows. Don Speck speck@vlsi.caltech.edu seismo!cit-vax!speck #!/bin/awk -f $1 == "#N" { site = $2; } $1 == "#L" { lat = long = coord = ""; scale = 1; for (i = 1; i <= length($0); i++) { ch = substr($0,i,1); if (ch ~ /[NEWS]/) { if (coord == "") break; if (ch ~ /[SW]/) coord = -coord; if (ch ~ /[NS]/) lat = coord; else long = coord; if (long > -180 && long < 180 && lat > -90 && lat < 90) { map[long " " lat] = map[long " " lat] "," site; break; } coord = ""; scale = 1; } if (ch ~ /[0-9]/) { len = 1; while (substr($0,i+len,1) ~ /[0-9.]/) len++; coord += substr($0,i,len) / scale; scale *= 60; i += len - 1; } } } END { for (pos in map) print pos, "\"" substr(map[pos],2,50) "\""; }