\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 = "\n"; #fwrite($xmlout,"$irlpnode\n"); # THIS WAS A BAD IDEA...kills the browser...memory hog if (preg_match("/^REF.*$/",$call)) { $irlpnode = ""; fwrite($xmlout,"$irlpnode\n"); } # just displaying points that correspond to a reflector, with appropriate # comments in the pop-up box. This isn't hard on the browser since there # is only a couple dozen reflectors. (compared to several thousand nodes) } # determine connection paths foreach ($edge as $var) { list($a,$b) = split(":",$var); if (preg_match("/9[0-9][0-9][1-9]/",$b)) { $b = substr($b,0,3); $b = $b."0"; $type='ref_sub_channel'; } elseif (preg_match("/9[0-9][0-9]0/",$b)) { $type='ref_main_channel'; } else { $type='peer_to_peer'; } # get long/lat stored in hash earlier by key node number if(isset($nodehash["$a"])) {$from=$nodehash["$a"];} else {$from=null;} if(isset($nodehash["$b"])) {$to=$nodehash["$b"];} else {$to=null;} if (($from != null) and ($to != null)) { list ($long1,$lat1)=split(",",$from); list ($long2,$lat2)=split(",",$to); if ($type == 'ref_sub_channel') { # connections to a reflector, sub channel #$connPath = ""; #$connPath .= ""; #$connPath .= ""; #$connPath .= ""; #fwrite($xmlout,"$connPath\n"); } elseif ($type == 'ref_main_channel') { # connections to a reflector, main channel $connPath = ""; $connPath .= ""; $connPath .= ""; $connPath .= ""; fwrite($xmlout,"$connPath\n"); } else { # point to point links $connPath = ""; $connPath .= ""; $connPath .= ""; $connPath .= ""; fwrite($xmlout,"$connPath\n"); } } } fwrite($xmlout,"\n"); fclose($xmlout); } // endif (on else, just re-use the existing XML file!) # end of program # functions (I don't remember why I did this line by line...will clean up later) function genTempFile($tmpfile,$source) { $data=file($source); $fhandle=fopen($tmpfile, "w"); foreach ($data as $var) { fwrite($fhandle,"$var"); } } ?> Google Maps
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.