×

Notice

The forum is in read only mode.

How to get a JSON feed

7 years 2 months ago #236 by kieran
Hi there I am very lost with the API I would like to be able to use a function like

var url = 'opensky-network.org/api/states/all';
$.when($.getJSON(url)).done(function(data) {
$.each(data.states, function(i, value) {
var myLatlng = new google.maps.LatLng(value.latitude, value.longitude);

For a project I am making
Any help is appreciated
PS My receiver is online but it shows offline with you guys.
7 years 2 months ago #237 by meides
Replied by meides on topic How to get a JSON feed
Hey kieran,

the following modified code prints all latitude and longitude values to the console:
var url = 'https://opensky-network.org/api/states/all'; //Include the protocol here (https://)
$.when($.getJSON(url)).done(function(data) {

    $.each(data.states, function(i, value) {
        console.log(value[5]+","+value[6]); //"value" is not an object but an array, so latitude and longitude have to be accessed by their index
    });
})

Please refer to out API documentation for details on the allocation of the value array.

PS My receiver is online but it shows offline with you guys.

I checked your profile and it seems your receiver is not receiving any messages. The availability chart uses message data to visualise the availability of the sensor. If no message is received over at least a 5 minute period of time, the sensor is considered to have been offline then. The little online-tag on the top left, on the other hand, indicates if a TCP connection to the receiver is active.

Best,
Marco
Powered by Kunena Forum