This project is really taking off! Thought I would add my two cents in with dynamic centering of the map and dynamic loading of radar sites using an airport identifier. This method uses PHP/MySQL to compare coordinates of the airport contained in one database table and calculates the distance to radar sites using their coordinates in another database table. From that calculation it then determines if the sites are within a predetermined range (ex: 300 miles) to create a string of multiple radar sites. The map is then centered on the airport you type in using its coordinates.
Also included in the attached code (Radar.txt) is a script to decode the current METAR from the airport you enter, which I found and modified from
http://woody.cowpi.com/phpscripts/. The author said the code is free to use, modify, and learn from. A live demo is available on my site at
http://www.chriswardmedia.com/weather.php.
Key columns referenced in Airports Table: ICAO, Lat, Lng
http://chriswardmedia.com/downloads/AirportsDatabase.csvKey columns reference in Radars Table: Name, Lat, Lng
http://chriswardmedia.com/downloads/NWSRadars.csvDistance Function in Miles:if((distance($icaolat, $icaolng, $nwslat, $nwslng))<300)* change 300 miles to whatever you think is appropriate/your setup can handle
Requirement: You will need a host that supports PHP and MySQL, and know how to create databases/import data into MySQL. You will also need to enter your MySQL connection information in the sections with:
$host="My.SqlServer.Com"; // Host name
$username="MyUserName"; // Mysql username
$password="WhateverYourPasswordIs"; // Mysql password Note: If you enter an identifier for a smaller airport that has METAR data, the coordinates may not available in the airports database. In that case the METAR info will load but the map will fail to load any radars and center at the equator in the Atlantic Ocean (0°,0°). If you enter an airport identifier that doesn't exist...the map won't load any radars and no METAR data will show up (go figure).