\n");
########################################################################
# PASS 1 - Record list of all node numbers of reflectors identified
# by ^REF[0-9]{4}$ matching in the callsign.
$nodes=file($tmpfile);
# skip header line
$headings=array_shift($nodes);
# open database, purge old records, leave db open
opendb();
$sql = "delete from irlp_status where 1=1";
$query = mysql_query($sql);
$mynode='';
foreach ($nodes as $mynode) {
list($node,$call,$city,$state,$country,$status,$record,
$instdate,$lat,$long,$lupdate,$freq,$offset,$pl,$owner,
$url,$lstatuchange) = explode("\t",$mynode);
# write data into database for future reference
$node=addslashes($node);
$call=addslashes($call);
$city=addslashes($city);
$state=addslashes($state);
$country=addslashes($country);
$url=addslashes($url);
$owner=addslashes($owner);
$sql = "replace into irlp_status (node,call,city,state,
country,status,record,instdate,lat,longitude,lupdate,freq,
offset,pl,owner,url,lstatuschange) values
('$node','$call','$city','$state',
'$country','$status','$record','$instdate','$lat','$long',
'$lupdate','$freq','$offset','$pl','$owner','$url',
'$lstatuchange')";
$query=mysql_query($sql);
if (!$query) {
#print "error in $sql\n";
#die();
}
if (preg_match("/^REF.*$/",$call)) {
$reflectorlist[$node]='Y';
$refid=substr($node,0,3);
$refidlist[$refid]='Y';
}
}
mysql_close();
########################################################################
# BEGIN PASS 2
# re-read tmpfile
$nodes=file($tmpfile);
# skip header line
$headings=array_shift($nodes);
$edgecnt=0;
# plot all nodes in $nodes array
$mynode='';
$nodecount=0;
foreach ($nodes as $mynode) {
$nodecount++;
list ($node,$call,$city,$state,$country,$status,$record,$instdate,
$lat,$long,$lupdate,$freq,$offset,$pl,$owner,$url,$lstatuchange)=explode("\t",$mynode);
# store all locations to draw lines
# recording all unknown location nodes in
# separate array
if (($long == null) or ($lat == null)) {
$unknownlocnodes["$node"]=$call;
}
$nodehash["$node"]="$long,$lat";
# store all edges for graph
if (preg_match("/[0-9]{4}/",$status)) {
$status=preg_replace("/(^.*)([0-9]{4})(.*$)/","$2",$status);
#print "$status
\n";
$edge["$edgecnt"]="$node:$status";
$conn["$node"]=true; # store connected nodes in hash
$edgecnt++;
$status_no_channel=substr($status,0,3);
if ( (isset($refidlist["$status_no_channel"])) and ($refidlist["$status_no_channel"]=='Y')) {
if(isset($reflectorcount["$status"])) {
$reflectorcount["$status"]++;
} else {
$reflectorcount["$status"]=1;
}
}
}
# possibly display all points via XML.
#$irlpnode = "
| Back to the KC5CQM homepage | |
| Source Code | |
|
My thanks to www.econym.demon.co.uk for their very helpful tutorial. This google maps implimentation of the IRLP connection map is very very much alpha / experimental at the moment. Only connections to main reflector channels (blue) and point-to-point links (green) are displayed. There are too many sub-channel connections in use to display. Maybe I'll add a toggle per channel later. In IE the polylines are actually VML vector-based. Hopefully the google map API will add support SVG as they did for Microsoft's VML. I'm rather suprized they didn't support SVG first. |