Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [SOLVED] Help Required Reading Json File For ISS Location Program Please

Author
Message
Jammy
21
Years of Service
User Offline
Joined: 15th Jan 2003
Location: Scotland
Posted: 29th Feb 2020 20:43
Hi,

I have came across an International Space Station locator API at http://open-notify.org/Open-Notify-API/ISS-Location-Now/ And thought I would like to make an app to get the information.

The Information comes as a json file and I can extract some of it but I cant get the Longitude and Latitude (they both come back as 0).
I am sure it has something to do with "MyType" Variable things as the Log and Lat data are in another "Object" as the help system says
Quote: "AGK type contains fields that are not specified in the JSON object then those fields will be set to zero."


Hope you can help.

Here is my code,



Thanks

The author of this post has marked a post as an answer.

Go to answer

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 29th Feb 2020 21:39 Edited at: 29th Feb 2020 21:40
This post has been marked by the post author as the answer.
iss_position is a type within a type so it should be.



Looks like a very interesting project. Good luck with t
Jammy
21
Years of Service
User Offline
Joined: 15th Jan 2003
Location: Scotland
Posted: 29th Feb 2020 23:36
Cheers blink0k

Knew I was doing something wrong with the Type just could not figure out how to put one inside other.

The site also gives the times for your location that the ISS is overhead and who is in it at the moment, Will now be able to incorporate that. Have only ever seen it once before.

Eventually might make a shoot em up where you have to defend the ISS using real data.

But at the moment just making an Info APP. Might even make a tutorial for STEAM.

Anyway Here is the full working code as It might help someone else.




blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 1st Mar 2020 00:24 Edited at: 1st Mar 2020 00:27
Jammy
21
Years of Service
User Offline
Joined: 15th Jan 2003
Location: Scotland
Posted: 1st Mar 2020 01:02
I did think about that

However It is not as easy as it used to be as google have changed their API and you now have to subscribe to get a key and though is free for light users it has a limited number of requests
see here https://developers.google.com/maps/documentation/maps-static/get-api-key

The demo (which I made) Geo Compass which is included with AppGameKit in the "user demos" no longer works because of this.

Was Going to just map the coordinates to an Atlas picture. Played with this before and it worked well.

I am now having trouble incorporating an Array from a json into a new Type giving the time the ISS is over your head and how long it will be visible for. here is an example of the json. It gives the next 5 times the ISS is overhead.

http://api.open-notify.org/iss-pass.json?lat=45.0&lon=-122.3

So far I have



I can get the message and request data, but not the response data

But I have many things to try yet if you are busy.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 1st Mar 2020 03:03 Edited at: 1st Mar 2020 03:07
responce needs to be defined as an array like so
Responce as Responce []



reference it like Pass.Responce[0].duration or Pass.Responce[0].risetime (where 0 is the element number)
you can get the number of elements (-1) by Pass.Responce.length

Login to post a reply

Server time is: 2024-11-22 11:24:44
Your offset time is: 2024-11-22 11:24:44