<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16481" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=968390802-12082007><FONT face=Arial size=2>Those looking for an
instant image creation solution for tracking may be interested in
this.</FONT></SPAN></DIV>
<DIV><SPAN class=968390802-12082007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=968390802-12082007><FONT face=Arial size=2>I take data and
stream it into mysql. I then use PERL GD to create an image on the
fly.</FONT></SPAN></DIV>
<DIV><SPAN class=968390802-12082007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=968390802-12082007><FONT face=Arial size=2>Here is an
example</FONT></SPAN></DIV>
<DIV><SPAN class=968390802-12082007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=968390802-12082007><FONT face=Arial size=2><A
href="http://vk4tec.no-ip.org/cgi-bin/adsb_create_image.cgi">http://vk4tec.no-ip.org/cgi-bin/adsb_create_image.cgi</A></FONT></SPAN></DIV>
<DIV><SPAN class=968390802-12082007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=968390802-12082007><FONT face=Arial size=2>And the code
</FONT></SPAN></DIV>
<DIV><SPAN class=968390802-12082007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=968390802-12082007><FONT face=Arial size=2>#!/usr/bin/perl
-w<BR>use CGI;<BR>use GD;<BR>use DBI;<BR>$x=0;<BR>$y=0;<BR>my $query = new
CGI;<BR>my $database_handler =
DBI->connect("DBI:mysql:adsb:host=localhost","root","");<BR>$query1="delete
from data where latitude like '%000%';
";<BR>$statement_handler=$database_handler->prepare
($query1);<BR>$statement_handler->execute;<BR>$query1="select min(latitude)
from data ";<BR>$statement_handler=$database_handler->prepare
($query1);<BR>$statement_handler->execute;<BR>$min_lat = $statement_handler
-> fetchrow() ;<BR>$query1="select min(longitude) from
data";<BR>$statement_handler=$database_handler->prepare
($query1);<BR>$statement_handler->execute;<BR>$min_lon = $statement_handler
-> fetchrow() ;<BR>$query1="select max(latitude) from data
";<BR>$statement_handler=$database_handler->prepare
($query1);<BR>$statement_handler->execute;<BR>$max_lat = $statement_handler
-> fetchrow() ;<BR>$query1="select max(longitude) from
data";<BR>$statement_handler=$database_handler->prepare
($query1);<BR>$statement_handler->execute;<BR>$max_lon = $statement_handler
-> fetchrow() ;<BR>$diff_lat = $max_lat - $min_lat;<BR>$diff_lon =
$max_lon - $min_lon;<BR>$lat_scale = 800 / $diff_lat;<BR>$lon_scale = 1200 /
$diff_lon;<BR>binmode STDOUT;<BR>print $query->header("image/png");<BR>my $im
= new GD::Image(1200,800);<BR>my $white =
$im->colorAllocate(255,255,255);<BR>my $black = $im->colorAllocate(0, 0,
0);<BR>my $red = $im->colorAllocate(255, 0, 0);<BR>my $blue =
$im->colorAllocate(0, 0, 255);<BR>my $green = $im->colorAllocate(50, 200,
0);<BR>my $purple = $im->colorAllocate(200, 0, 255);<BR>my $orange =
$im->colorAllocate(255, 200, 0);<BR>my $grey = $im->colorAllocate(80, 80,
80);<BR>my $light_blue = $im->colorAllocate(0,255,255);<BR>my $yellow =
$im->colorAllocate(255,255,128);<BR>$im->filledRectangle(0, 0, 1200, 800,
$grey);<BR>$query1="select distinct code from
data";<BR>$statement_handler=$database_handler->prepare
($query1);<BR>$statement_handler->execute;<BR>while (($code) =
$statement_handler -> fetchrow())<BR>{<BR>$query2="select
abs(latitude),abs(longitude),altitude from data where code = '$code' order by
seq desc limit 1";<BR>$statement_handler2=$database_handler->prepare
($query2);<BR>$statement_handler2->execute;<BR>while (($lat,$lon,$alt) =
$statement_handler2 -> fetchrow())<BR>{<BR>$x = int(($lon - $min_lon) *
$lon_scale);<BR>$y = int(($lat - $min_lat) *
$lat_scale);<BR>$im->filledRectangle($x-2, $y-2, $x+2, $y+2,
$green);<BR>$im->string(gdSmallFont, $x+23, $y-22, "$code",
$light_blue);<BR>$im->line($x+2.5,$y-2.5,$x+15,$y-15,
$green);<BR>$im->string(gdSmallFont, $x+23, $y-10, "$alt ft",
$yellow);<BR>}<BR>}<BR>$query1="select
seq,dtg,code,callsign,altitude,abs(latitude),abs(longitude) from data order by
code";<BR>$statement_handler=$database_handler->prepare
($query1);<BR>$statement_handler->execute;<BR>while
(($seq,$dtg,$code,$callsign,$alt,$lat,$lon) = $statement_handler ->
fetchrow())<BR>{<BR>$data_count++;<BR>$x = int(($lon - $min_lon) *
$lon_scale);<BR>$y = int(($lat - $min_lat) *
$lat_scale);<BR>$im->setPixel($x,$y,$green);<BR>}<BR>$date2=time();<BR>($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
= localtime($date2);<BR>if ($mday < 10)<BR>{<BR>$day =
"0".$mday;<BR>}<BR>else<BR>{<BR>$day = $mday;<BR>}<BR>$month = $mon + 1;<BR>if
($month < 10)<BR>{<BR>$month = "0".$month;<BR>}<BR>if ($hour <
10)<BR>{<BR>$hour = "0".$hour;<BR>}<BR>if ($min < 10)<BR>{<BR>$min =
"0".$min;<BR>}<BR>if ($sec < 10)<BR>{<BR>$sec =
"0".$sec;<BR>}<BR>$year+=1900;<BR>$date1 = $day."/".$month."/".$year."
".$hour.":".$min.":".$sec;<BR>$im->string(gdLargeFont, 21, 10, "ADS-B Display
$date1 - Andrew Rich 2007 - $data_count points from MySQL table ",
$light_blue);<BR>$im->string(gdLargeFont, 21, 25, "$min_lat $max_lat $min_lon
$max_lon ", $light_blue);<BR>print
$im->png;<BR>$date2=(time()-(60*10));<BR>($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
= localtime($date2);<BR>if ($mday < 10)<BR>{<BR>$day =
"0".$mday;<BR>}<BR>else<BR>{<BR>$day = $mday;<BR>}<BR>$month = $mon + 1;<BR>if
($month < 10)<BR>{<BR>$month = "0".$month;<BR>}<BR>if ($hour <
10)<BR>{<BR>$hour = "0".$hour;<BR>}<BR>if ($min < 10)<BR>{<BR>$min =
"0".$min;<BR>}<BR>if ($sec < 10)<BR>{<BR>$sec =
"0".$sec;<BR>}<BR>$year+=1900;<BR>$date1 = $year."-".$month."-".$day."
".$hour.":".$min.":".$sec;<BR>$query="delete from data where dtg <
'".$date1."'";<BR>$statement_handler=$database_handler->prepare
($query);<BR>#$statement_handler->execute;</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=968390802-12082007><FONT face=Arial
size=2><BR></FONT></SPAN> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2>----------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT face=Arial size=2>Andrew Rich VK4TEC</FONT></DIV>
<DIV><FONT face=Arial size=2><A
href="mailto:vk4tec@people.net.au">vk4tec@people.net.au</A></FONT></DIV>
<DIV><FONT face=Arial size=2><A
href="http://www.tech-software.net/">http://www.tech-software.net</A></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV> </DIV></BODY></HTML>