Welcome, Guest
Username: Password: Remember me

TOPIC: How to get a JSON feed

How to get a JSON feed 2 years 2 months ago #236

  • kieran
  • kieran's Avatar
  • Offline
  • New Member
  • Posts: 1
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.
The administrator has disabled public write access.

How to get a JSON feed 2 years 2 months ago #237

  • meides
  • meides's Avatar
  • Offline
  • Administrator
  • Posts: 53
  • Thank you received: 21
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
The administrator has disabled public write access.
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!
More information Ok