#!/usr/bin/perl ##################################################### open(FILE, "./COLORLOOKUP.TXT"); while() { ($name, $code, $color) = split/\t/, $_; $color=~s/\s+$//; if ($code eq '') { $code = 'eng'; } $COLORHASH{$code} = $color; } close(FILE); ##################################################### #$width=12288; $height=6144; $width=4000; $height=2000; open(OUTGV, ">$ARGV[0].dot"); print OUTGV "strict graph converted {\n\tncorner0 [height=\"0.0\",width=\"0.0\",pos=\"0,0\",style=\"invis\"];\n\tnocorner1 [height=\"0.0\",width=\"0.0\",pos=\"$width,$height\",style=\"invis\"];\n"; open(FILE, $ARGV[0]); $NODEID = 0; while() { ($lat, $long, $cnt, $lang) = split/,/, $_; $lang=~s/\s+$//; $color = $COLORHASH{$lang}; if ($cnt > 0 && $color ne '') { $plat = $lat; $plong = $long; $plat+=90; $plong+=180; #offset to 0,0 $plat=$plat*$height/180; $plong=$plong*$width/360; #norm to 100x100... $plat = sprintf("%0.4f", $plat); $plong = sprintf("%0.4f", $plong); print OUTGV "\tn$NODEID [height=\"0.01\",width=\"0.01\",pos=\"$plong,$plat\",style=\"filled\",shape=\"point\",color=\"${color}FF\",fontcolor=\"${color}FF\"];\n"; $NODEID++; } } close(FILE); print OUTGV "}\n"; close(OUTGV); print "Rendering...\n"; print "CMD(neato -Gviewport=\"$width,$height\" -Gbgcolor=#000000 -n -Tpng $ARGV[0].dot > $ARGV[0].png)\n"; system("neato -Gviewport=\"$width,$height\" -Gbgcolor=#000000 -n -Tpng $ARGV[0].dot > $ARGV[0].png"); #########################################################################