Page 2 of 3

Re: Virtual Radar+Apache

Posted: Thu Mar 22, 2012 12:54 am
by madrigal
OK, here is it my version.
Please note: there is nothing out-of-the-box - some changes in original JavaScript files have to be made and a relatively good knowledge of Linux/Unix administration is necessary. Read README_FIRST file first :)
Of course a lot of capabilities of original VRS are missing at the moment but as you can see it just works and can be used as a proof of concept.
I'll be glad to answer to your questions.
Since forum rules don't allow to upload files greater than 256 kb, you can download the code from:
http://87.120.4.1/vr/vr-linux.tar.gz

Re: Virtual Radar+Apache

Posted: Tue Mar 27, 2012 11:04 pm
by madrigal
I've made an update to my code:
- added decoding of airplane's country
- added decoding of airline
- added decoding of airplane's route based on flightnumbers
For decoding of airlines and routes I've tried to stick as close as possible to original Andrew's approach.
There are additional files needed for decoding - Countries.dat, AirlineCodes.csv, AirportCodes.csv and FlightNumbers.csv which are added to archive file. They can be downloaded (and I suggest you to do that in order to have the last updated files) from http://www.virtualradarserver.co.uk/FlightRoutes.aspx
Updated and new files can be downloaded from: http://87.120.4.1/vr/vr-linux-20120328.tar.gz. Note - it is an update only - you'll need the other files too (http://87.120.4.1/vr/vr-linux.tar.gz) if you want to make a fresh install.

Re: Virtual Radar+Apache

Posted: Thu Apr 05, 2012 3:42 pm
by madrigal
A nasty bug in update 30003-json-1.pl was found by sergsero (thank you).
Please redownload vr-linux-20120328.tar.gz again.

Re: Virtual Radar+Apache

Posted: Wed Apr 11, 2012 10:12 pm
by manu67b
Many thanks Madrigal for that linux version and of course to the creator of VRS (Andrew)

It is working on my linux box after a few tweaking on the perl side.

not a fan of JS, I'm looking to get the pictures working if someone had a look already would be happy to be able to implement it :)

You can get a view on my maps:
the original (VRS) here: http://46.105.56.167/VirtualRadar/GoogleMap.htm
the linux version is available here: http://88.186.230.159/vr1/

I've noticed that on the linux version is a bit slower to display all the aircrafts and the aircraft tags are not transparent. I guess the transparency is just something more to tweak on my side ?
I see more aircrafts on the linux verion, but here i think it is perhaps a timeout issue when an aircraft is not seen anymore that expires faster on the VRS client (to be confirmed)

Thanks again

Re: Virtual Radar+Apache

Posted: Thu Apr 12, 2012 10:29 pm
by madrigal
Hi,
I'm glad that someone looked at my code. I cannot tell I'm a great Perl coder so it's perfectly possible that there are places where the program can be optimised. I'll be very happy if you share the changes you've made.
Concerning the speed of the program - since Airplane.cgi is a CGI script it is called every time when the generation of the picture is needed. That's why the speed is slower comparing the code permanently loaded in the memory. Yes, I know there is Fast CGI but I haven't played with it. May be it is the time to give it a try.
For the transparency - it is a limitation of GD library (and more precisely - the Perl interface to GD). I've tried to add some "fuzziness" to the text but without success and since the text's contrast (without the background) was bad I decided to add a grey rectangle beneath. You can see that if you look at Airplane.cgi code. The better results can be obtained if you implement a PHP script for interfacing the GD libraries instead of CGI. The gain will be twofold - once since the PHP code is loaded in the memory only once and second - I saw some implementations of "imageblur" PHP's function with a good results for adding fuzziness to the text. There are however some problems with Debian versions of PHP and GD modules and since I cannot recompile the PHP on my server for various reasons, I gave it. Nevertheless I'll be glad if someone implement and show this approach.
What about the number of the aircrafts - may be the reason is in the different criteria we use for updating the AC positions and removing them from the map (just observe closely Andrew's code and mine, even though it is harder for me to follow the C# code - it is too "scattered" for my taste - no offence, please).
Concerning the time for removing the planes from the map - in my searches for good Google Map interface for displaying ADS-B data I stumbled upon Curt Deegan's code used by PlanePlotter (I think). In it he decided that if no data is received for a particular plane for more than 45 sec. (or whatever you decide), the plane's picture changes it's colour - from white to yellow (or red or blue etc.). It is a good indication that the data for that plane is not updated any more. After additional 1-2 minutes the plane is removed from the map. It is a hint for Andrew - I think the efforts to implement that will not be so great.

Re: Virtual Radar+Apache

Posted: Fri Apr 13, 2012 5:52 pm
by agw
The aircraft in VRS are removed from the map 30 seconds after their last message and then they're removed from the aircraft list 10 minutes after their last message. You can configure the number of seconds before an aircraft is removed from the map in the options - http://www.virtualradarserver.co.uk/Doc ... tions.aspx, it's the "Duration (in seconds) between loss of signal and aircraft being removed from map" option. I think BaseStation defaults to 120 seconds, I use 30 because I'm under the flight path for westerly arrivals to Heathrow and if I have the timeout at two minutes the planes tend to stack up on top of each other when I lose sight of them just before they land. They can come in thick and fast at Heathrow :)

One thing you might want to consider if you can't add a blur behind the text is to outline the text in black instead. You could draw the text in solid black a little bit larger than normal and then redraw it at normal size in white, both times centred on the same point. You'd probably have to do that line by line. If Perl offers the option to outline the text in a different colour to the fill then that would help.

Looking back at the code the way I do it is to draw the text at a quarter of its size with a grey rounded outline and black fill and then resize it with anti-aliasing to the proper dimensions - the rescaling is what produces the blurry shadow effect. Then I draw the text in white with a light grey outline on top. The black fill produces a nice darker shadow away from the edges but if you can't outline text then drawing the blur entirely in grey should be alright. But if your Perl library doesn't support anti-aliasing then that might come out a bit messy for you.

Re: Virtual Radar+Apache

Posted: Sat Apr 14, 2012 11:14 am
by manu67b
Hi,

Only able to do a few things in php, i'll try to convert the cgi script if I can.

I came across this page http://www.puremango.co.uk/2009/04/php- ... mage-blur/ when it comes to blur an image with php.
Regarding the perl code, the only thing I did was not on your code but on my perl installation that was missing a few libs on my debian installation.

For the moment I have more problems with my virtual machine stability running basestation, VRS, active display and PP.

By the way regarding active display, I've tried Andrew's db writer but Active display is not able to work with it properly.

My ultimate goal is to get that only working on my linux box, populating a mysql DB for at the end generate some statistics, being able to replay flights and populate properly aircraft informations.
But this takes time and I must admit that lately I miss some...

Re: Virtual Radar+Apache

Posted: Sat Apr 14, 2012 6:07 pm
by madrigal
@manu67b - I can share my code for decoding SBS-1 port 10001 messages - it will overcome the need to run BaseStation.
My goal is same as yours - DB support and ability to generate reports (may be via VRS reporter). I'm not sure if I'm going to use original BaseStation.sqb format of tables or to cut some columns in order to save space and resources. DB definitely will need one more table - for saving info for plane's routes.

Re: Virtual Radar+Apache

Posted: Sun Apr 15, 2012 4:25 pm
by manu67b
@Madrigral,

thanks for the offer, I was using Piotr code http://piopawlu.net/tag/sbs1xxx/. Do you use your own code ?
Nice to see I'm not the only one working on that :) I thought that for compatibility purpose I would keep the same DB structure, because if I want to export the datas to work with something that is ready the BaseStation.sqb, this would avoid any problem.
Another thing I need to think about is that I have more than one box is different locations so I need to gather/consolidate the datas and avoid duplicates.

Re: Virtual Radar+Apache

Posted: Mon Apr 30, 2012 10:50 pm
by ianhind
Joined the forum to say thank you. I appreciate Andy's efforts but running on Linux was where I wanted to be.

Excellent effort getting this working on Linux. After installing a few libs, i got it working on Debian Squeeze. Eventually realised that I needed GD and GD::Text to get the aircraft showing.

If the aircraft showed the registration from a recent basestation.sqb (no need to write to it, just read), then this would be even better.

I wish I had your skills. I look at your source code (including Andy's of course) and it just about makes sense to me but I wouldn't be able to do it myself. So thank you for sharing.

Ian