Convert IRIDFLAR output to HTML
3432P@VM1.CC.NPS.NAVY.MIL
Mon, 27 Oct 97 09:59:34 PST
I love Rob Matson's new IRIDFLAR feature that shows the lat/long of
the best location to see a flare. I quickly tired, however, of manually
entering the coordinates into the Tiger Map Server, so I spent an hour
or so and wrote an editor macro to convert the IRIDFLAR output file into
an HTML document. The lat/long coordinates are converted to a clickable
hyperlink to the Tiger Map Server. I have a batch file that runs IRIDFLAR,
and then runs the macro, which produces the HTML file. I have a bookmark
to the local HTML file, so I'm just a few clicks away from results.
Since the code is only 78 lines, I hope I don't upset anyone by taking
the liberty of including it in this post. Of course, if you don't happen
to use the text editor I use (KEDIT, a commercially available program),
then the macro won't work as-is, but it still might be useful as a design
template for someone to rewrite it using another language.
--start--
*
* IRIDMAP v1.0
*
* Use the KEDIT text editor, and its built-in KEXX language (a subset of
* REXX), to change the output of Rob Matson's IRIDFLAR program. The
* output is converted to an HTML document, with the latitude and longitude
* of the flares changed to hyperlinks to the Tiger Map Server (U.S. Only)
* This macro is freeware and is released to the public domain.
* Craig Cholar 3432P@VM1.CC.NPS.NAVY.MIL 27 October 1997
*
url1 = '<A HREF="http://tiger.census.gov/cgi-bin/mapsurfer?infact=2&outfact=2'
url2 = '&on=majroads&on=places&on=railroad&on=streets&on=statehwy&on=ushwy'
url3 = '&act=move&tlevel=-&tvar=-&tmeth=i&mlat='
url4 = '&mlon='
url5 = '&msym=smalldot&mlabel=&murl=&lat='
url6 = '&lon='
url7 = '&wid=0.360&ht=0.130&conf=mapnew.con"'
label? = 1 /* Enable or disable optional label next to map pinpoint */
/* The label consists of Iridium number, month/day, time */
'PRESERVE' /* Save current editor settings */
'SET ARBCHAR OFF' /* Disallow wildcards during change */
'SET LINEND OFF' /* Disable special line end character */
'SET WRAP OFF' /* Don't wrap back to top after hitting end-of-file */
'SET MSGMODE OFF' /* Hide routine messages */
'TOP' /* Start at top of file */
'FIND --------' /* Find the last header record */
'NFIND __' /* Look for next non-blank line */
do while rc = 0 /* Loop until we hit end-of-file */
'EXTRACT /CURLINE/' /* Put contents of line in the string "curline.3" */
n = words(curline.3) /* n = Number of blank-delimited words on the line */
if n > 1 then do /* Do we have at least two words on the line? */
lat = word(curline.3,n-1) /* Lat. is assumed to be next-to-last word */
lon = word(curline.3,n) /* Long. is assumed to be the last word */
if pos('.',lat)>0 & pos('.',lon)>0 then do /* Periods in lat/long? */
/* Use concatenation (||) to create the long URL string */
hyperlink = url1||url2||url3||lat||url4||lon||url5||lat||url6||lon
/* Change the lat/long to a link to the Tiger Map URL */
'CHANGE !' lat lon '!' hyperlink'">'lat lon'</A>!'
if label? = 1 then do /* Identifying label next to map pinpoint? */
/* Parse out Iridium number, year, month, day, hrs, min, secs */
parse var curline.3 iridium yy'-'mo'-'dd hh':'mm':'ss'.'tenths .
/* Ensure the values have leading zeros, and are right justified */
mo = right(strip(mo,'L'),2,'0')
hh = right(strip(hh,'L'),2,'0')
mm = right(strip(mm,'L'),2,'0')
ss = right(strip(ss,'L'),2,'0')
/* Use CHANGE command to insert label. Tigermap uses special */
/* character sequences for the '/' and ':' in the date & time. */
/* Use %2F for '/', and %3A for ':'. Use the ! character as a */
/* change delimeter since it doesn't appear in the URL string. */
'CHANGE !mlabel=!mlabel=I'iridium'+'mo'%2F'dd'+'hh'%3A'mm'%3A'ss'!'
end
end
end
'NFIND __' /* Find next non-blank line */
end
'TOP' /* Back to top of file */
'INPUT <TITLE>Iridium flares</TITLE>' /* Insert HTML headers */
'INPUT <H1>Iridium flares </H1>'
'INPUT <pre>'
'BOTTOM' /* Go to bottom of file */
'INPUT </pre>' /* Insert last HTML statement */
'RESTORE' /* Restore original editor settings */
'SET FILEID C:\IRIDMAP.HTM' /* Hardcode the local PC filename */
'SSAVE' /* Save the changes */
exit
--end--
Incidently, I have a pass coming up with a centerline that's a very short
distance from my house, just to the west. The trouble is, it's just offshore
in the Pacific! I'll think I'll elect to stay dry, and forego the riptides.
Craig Cholar 3432P@VM1.CC.NPS.NAVY.MIL
Marina, California
36 41 10.3N, 121 48 17.9W (36.6862, -121.8050) UTC -8