Coder Social home page Coder Social logo

canotapi's People

Contributors

rt-2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

canotapi's Issues

Use Objects instead.

Yeah basically I'd create a Notam objects that could be played with.

I think I would add that in the background of the existing 2 functions and add CANotAPI_GetNotamsObjectList to get an array of NOTAMs objects.

rt-2

Better Sources / API

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 :)

"Local NOTAM only" is not stripped out for smaller airports

The regular expression on line:

preg_replace('/(Local NOTAM only\s+C[A-Z]{3})/',' ', $html);

should be replaced with:

preg_replace('/(Local NOTAM only\s+C[A-Z0-9]{3})/',' ', $html);

To allow NOTAMs for smaller airports (like CNZ8 and CNC4) to not include the "Local NOTAM only" string.

CANotAPI_GetNotamsArray

Basically CANotAPI_GetNotamsString would return an associative array with all kind of separated information including the whole line of text.

Don't inject HTML in response, return array instead

The usefulness of API is limited as it returns a concatenated string of the NOTAMs with HTML interspersed. The formatting and presentation should not be dictated by the API, this should be done by the application calling the API. The suggestion is to remove all HTML from the response and return an array of the NOTAMs instead to the application.

For example, the following line:

$ret .= '<span class="'.$classes.'">'.$this_notam_text.'</span><br><br>';

should be changed to:

$ret[] = $this_notam_text

And $showfooter should be permanently set to false and/or removed.

API docs

Hello. I see in the code you're directly accessing a plan.navcanada.ca API. Do you have docs for this API? I would like to use it as well.

Use DOM XPATH instead of str_replace

You don't have to do all these issues yourself, when I get around to it I would be happy to help you. In the meantime, I think you should stop using the find/replace method with using the DOM. With a script this size we could probably evaluate exactly how much more efficient the two methods are but I am going to guess the DOM method will be much faster.

http://php.net/manual/en/domxpath.query.php

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.