How to get a JSON feed

6 years 7 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.

Please Log in or Create an account to join the conversation.

6 years 7 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

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum
This website uses cookies to offer you the best experience of our services. By using this website you agree to our privacy policy!