Flightradar24 is a flight tracking service that provides you with real-time information on thousands of commercial and recreational aircraft. Fed by ADSB and FAA radar information, the system relies on an army of volunteers that upload ADSB data (from their own receivers) to Flight Radar’s servers, before that information is processed and made available to anybody with a computer or smartphone.
The process of including a map embedded within an iframe on your own website, WordPress or otherwise, is exceedingly simple. The following URL is used:
<iframe src="http://www.flightradar24.com/simple_index.php?lat=49.9&lon=12.3&z=8" width="100%" height="100%"></iframe>
Why Create a Plugin?
We created a plugin only to simplify the process of embedding a plot. For starters, the iframe URL requires knowledge of a location’s latitude and longitude – something that’d scare many people away. Add to that the complexity of altering other options and we quickly justified a couple of hours work. Of course, we have bigger plans that’ll see us integrate other types of information from other data providers, so this is really just a start.
How to Use the Flight Radar WordPress Plugin
Usage is easy. Once downloaded and activated, the means in which you’ll get a plot embedded within your post or page is as follows:
[flightradar code="syd"] or [flightradar code="yssy"]
Note that either the IATA code of SYD or the ICAO code of YSSY can be used. When the shortcode is processed, a request is made to our Flight Airports API. XML data is returned and the latitude and longitude for the requested location is stored locally so no further requests are made to our API for that specific location.
The resulting default rendering looks like this:
You’ll note a significant amount of branding on the embedded data; this is unavoidable. In fact, using the FlightRadar24 service requires that you provide attribution back to their website .
Available Shortcode Options
code : 3-letter IATA or 4-letter ICAO airport code.
lat : Latitude (if known)
lng : Longitude (if known)
zoom : Zoom level, Defaults to 8.
width : Width of the rendered plot. Defaults to 100% of your post/page container.
height : Height of the rendered plot. Defaults to 350 pixels.
align : Alignment of the plot. Defaults to ‘center’.
For example, you could alter the plot size and zoom level with the shortcode of:
[flightradar code="yssy" zoom="12" height="550"]
Flight Airports API
The Flight Airports API is one of numerous API’s we make available to clients (and ourselves) for various applications. Available in XML, JSON and text, the Airports API (used in the very basic manner described on this page) will return various details relating to an airport – including the latitude and longitude required for the FlightRadar24 URL.
http://api.flight.org/airports/xml/syd/airport.xml – “syd” is replaced with any ICAO or IATA airport code. View the XML data here.
It’s always best to make a request using an ICAO code rather than the limiting IATA data. IATA data is more relevant to ports that accommodate RPT and therefore agent ticketing services… meaning that they represent only a small percentage of available ports.
If you know the latitude and longitude for an airport, no request is (initially) made to the API. Remember, a request to the API is made only the first time you query a particular airport; data is then stored locally for future retrieval.
The advantages of shortcode can’t be overstated: they’re awesome. If you plan on ever embedding the FlightRadar24 data on your website, you would be wise to use shortcodes so that they can all be adjusted or amended in the future – globally.
If you’re not one for plugins, but you still keep a customsfunctions.php file, you can copy and paste the following code and use it in a manner similar to that as described above, with the exception that it won’t query the API (so you won’t be able to use airport codes). It’s designed for brevity!
Shortcodes should always be used for repetitive tasks. Although the air traffic radar space is quite sparse at the moment, a good example of why shortcodes provide flexibility comes from a video container. If we wanted to change the container we use to display videos on this website, we would only have to alter one line of code, rather than alter the code on every single page we decide to embed a video.
If we chose to change radar provider in the future, include additional data or cater to any changes a provider might make – all of which is likely – no alteration would be made on any page where we’ve already embedded data.
Download Flight Radar
The plugin is called Flight Radar because future iterations won’t necessarily rely exclusively on FlightRadar24 data – this is just a start. You can download it from WordPress.org here .
Of course, you can search for “Flight Radar” from within the WordPress dashboard and install directly to your WordPress website.
The plugin is unlikely to change the world.
Shortt URL for this post: