[net.news.adm] Useful #L entries in uucp map

campbell@maynard.UUCP (Larry Campbell) (08/30/86)

In article <432@epimass.UUCP> jbuck@epimass.UUCP (Joe Buck) writes:
>One way of putting pressure on people to improve their #[A-Z] lines
>would be to post some software that actually does something
>interesting with them.  As long as they are just comments, there's
>little incentive to maintain them.

Funny you should mention it.  I just posted a program to net.sources
that uses the information in the '#L' lines to draw a map on a screen
or plotter or whatever of a piece of the UUCP net.  In the course of
debugging it I noticed that most of the '#L' entries are either wrong
(too many people just give the "city" location) or incomprehensible.
Let's hope my posting encourages people to give accurate and parseable
'#L' entries.
-- 
Larry Campbell                             The Boston Software Works, Inc.
ARPA: campbell%maynard.uucp@harvard.ARPA   120 Fulton Street, Boston MA 02109
UUCP: {alliant,wjh12}!maynard!campbell     (617) 367-6846

mangler@cit-vax.Caltech.Edu (System Mangler) (08/31/86)

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) "\"";
}

mark@cbosgd.UUCP (Mark Horton) (09/02/86)

Would one of you folks who has been writing a program to parse the map
data be so kind as to create a modified version of your program which
can be easily used to check the data for syntax errors?  It should
produce error messages that can be easily used to find the offending
line, e.g. mention the file and line number.  It should not produce
plotter output or require anything other than vanilla UNIX to compile.

The more it checks, the better, but if you just use your parsing code
for whatever data you use (lat/long, maybe the phone number, sure would
be nice to check the postal address too) we can ask our map coordinators
to run it when they update the database, and hopefully eliminate this
sort of syntax error.

If such a program already exists and I missed it, I apologize in advance.

	Mark