Live map with API

Hi everyone,

As you might guess, I finally got my API key and now there’s only one hurdle left to create a live map. How can I do that?

What I want is for visitors to see me and my friends live when they view the map. Can you help me with this?

Hello!

Here is what I would suggest doing. Of course, there are countless ways to go about this, so you can change anything based on your own preference.


The first step would be to go to the Infinite Flight Developer Reference and look at the documentation. This tells you what the API does, what the rules are, and how to use it.

If you simply want to see where your friends are on the map, you should use “Get Flights”. If you want to see more information (flight plan, user stats, ATC, etc) you’ll need to use other endpoints.


The next step would be to choose your programming language (depending on what you’re planning on making) and get your documents set up.

If you don’t have any coding experience, I’d suggest looking at W3 Schools (They make nice coding tutorials) and StackOverflow (they’re a Q&A forum. If you have a problem, someone on StackOverflow almost certainly had that same problem a few years ago). Of course, YouTube, Reddit, Wikipedia, etc are also your friends.


Assuming you’re going to make a website with an interactive map, there are a few ways to add a world map to your page. I would suggest looking into Leaflet and Mapbox, although many alternatives exist. It’s up to you :slight_smile:


Once you have your interactive world map set up, you can add aircraft through the “Get Flights” endpoint.

{
  "errorCode": 0,
  "result": [
    {
      "username": "Cameron",
      "callsign": "EC-CAM",
      "latitude": 30.123479009207056,
      "longitude": 31.413340256981044,
      "altitude": 597.8003749797689,
      "speed": 185.3844049009562,
      "verticalSpeed": 2167.31591796875,
      "track": 162.13836669921875,
      "lastReport": "2020-10-02 00:46:19Z",
      "flightId": "348d1ba8-1e60-48ca-8278-42f019147de8",
      "userId": "3f8b28bf-bbb1-4024-80ae-2a0ea9b30685",
      "aircraftId": "de510d3d-04f8-46e0-8d65-55b888f33129",
      "liveryId": "c875c0e9-19c2-420d-8fb4-32c151bd797c",
      "heading": 159.33542,
      "virtualOrganization": "IFATC [IFATC]",
      "pilotState": 0,
      "isConnected": true
    }
  ]
}

This is what a typical response looks like for that endpoint (Source)

In the API response, you’ll get user information, flight information, and aircraft information. What you’ll need to do is write some code that takes the GPS coordinates from the API response and places them on the map (usually with a little circle, or an airplane icon as a marker).

Once you have the locations of aircraft on the map, there’s pretty much no limit to what you can do. The Live API provides a lot of information. All you need is a bit of coding knowledge, a bit of creativity, and your RAM is the limit!


Just FYI, if you just want to see where your friends are without the hassle of coding, there are many third-party trackers that already exist :slight_smile: You can check them out here.


Have fun and follow the API rules.

1 Like

Thank you, Camille.

1 Like

Excuse me, I’ve tried a few times but unfortunately I couldn’t do what I wanted. Could you please explain how to create maps used for websites?