rt-2 / CANotAPI

The Canadian Notams API
5 stars 1 forks source link

Better Sources / API #2

Closed teamcoltra closed 7 years ago

teamcoltra commented 7 years ago

Looking at the website http://www.zuluforpilots.com/Map it appears they pull all NOTAMs directly from NavCanada through AFTN... and I believe there has to be an API directly from NavCanada somewhere to pull this data from. Foreflight is doing it, other organizations are doing it. The problem is this limits us to 6 airports it would be great to figure a way to get as many airports or a region if we wanted.

I will star and follow the code :)

rt-2 commented 7 years ago

This is an interesting discussion. The main difference between this and other NOTAM sources, is that I designed this for a webmaster to use it in his website and be able to play with the data eventually, Laminar Data and API Data Service might do something similar, but they require a key, and this is the charm of this thing, it's just a PHP include. Originally I made this for the CZUL FIR and other VATCAN division of the VATSIM Network, so it was not a problem to have only Canadian airports. I had the idea of maybe making a US version on the same principle, especially if people are asking for it. Now it would seem that zulugorpilots.com communicate with NAV CANADA to retrieve NOTAMs of other airport "through AFTN". Maybe they have an affiliation with NAV CANADA to retrieve information from AFTN through them.

It sure would be nice to include all airports, but at first it was just a small challenge I gave myself during a discussion with the FIR chief.

This publication contains somewhat related info here, here, here and here. AFTN seems like a closed circuit.

here(AFTN) and here(AMHS) we can read that it seems inaccessible from the internet. I did not do extensive research because I lack of time, but this is what I found.

I don't know if practice, What do you think? rt-2

teamcoltra commented 7 years ago

Yeah I am currently searching for the method they are using, and looking for other methods. The US has extensive methods of collecting this data, sadly it's not so in Canada. Looking at how many people use ZuluForPilots it's not many people (they have like 20 followers on Facebook and not many Twitter followers) and they don't have a product so they are not charging for anything which leads me to believe the source they are using is free.

Now there is also the availability of just using the API that they have made for their own service and pinging that, which would at least give you JSON responses instead of the ugly responses given by NavCanada.

I am looking into this myself, it's nice that we started our projects around the same time. If I find anything I will send it your way or make a pull request.

But trust me, I know that sometimes all you need is a simple php script to pull some data and the rest isn't really important. :)

rt-2 commented 7 years ago

Interesting, good point about ZuluForPilots.

What API are you talking about when you say the API 'they' have made?

Thank you,

teamcoltra commented 7 years ago

If you watch the network requests in chrome you can see things like http://www.zuluforpilots.com/NotamApi/GetAerodromeNotams?code=CYVR

You could do something like:

function getNotam($airportCode) {
if(is_array($airportCode)) {
foreach($airportCode as $code) {
$return[$code]json_decode(file_get_contents("http://www.zuluforpilots.com/NotamApi/GetAerodromeNotams?code=$code"));
}
} else {
$return[$airportCode]json_decode(file_get_contents("http://www.zuluforpilots.com/NotamApi/GetAerodromeNotams?code=$airportCode"));
}
return $return;
}
teamcoltra commented 7 years ago

I just typed that all out which is why it isn't formatted, it's probably not correct and I probably should do the else as turn the array into an array of one and then foreach at the end. It's all just a proof of concept anyway.

rt-2 commented 7 years ago

I just realized that zuluforpilots doesn't work outside of Canada, I though the whole purpose of this issue was to have all airports not only Canadian? rt-2

teamcoltra commented 7 years ago

It works a little outside of Canada if you go to their site and zoom out and into different regions you can see... that said it's primarily focused on Canada but isn't your code too? For my needs I just need Canada. The problem is that the Canadian source sucks because you have to format it's text replies and it also limits you to only 6 airports at a time.

rt-2 commented 7 years ago

I wanted to add an array version of this(#1), would that help you? What do you mean by 6 airports at a time? rt-2

teamcoltra commented 7 years ago

Oh you are only doing a single airport, your data source actually allows up to 6 airports information to be given at once. Sadly only 6.

rt-2 commented 7 years ago

First of all I had huge problem because 'CYUL' was hard coded at some placed, fixed here.

Secondly, what NAV CANADA does if you query 6 airport, it will just write it down one after the other, so you can basically call CANotAPI_EchoNotamsString 6 times in a row and you will have the exact same result.

rt-2

teamcoltra commented 7 years ago

Ugh you fixed that! :P I saw those and was going to fix them in the morning for you and be able to get my first pull request in.

rt-2 commented 7 years ago

Well sorry :P Other than that ZuluForPilots also can only fetch Canadian NOTAMs. And the ability to query multiple airport I think is not really important since it's already possible with the current state IMO. Is there any other enhancement you meant in this issue? rt-2

teamcoltra commented 7 years ago

We can close this for now. If I have any further ideas on the subject, I'll reopen it.