Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why can't I see the route of my flight plan? #13

Closed
ElSabio97 opened this issue Nov 8, 2021 · 5 comments · Fixed by #15
Closed

Why can't I see the route of my flight plan? #13

ElSabio97 opened this issue Nov 8, 2021 · 5 comments · Fixed by #15
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@ElSabio97
Copy link

Hi!

I'm creating a flightplan using the following code:

import flightplandb as fpdb

# obviously, substitute your own token
api = fpdb.FlightPlanDB("I inserted my own token here")

query = fpdb.datatypes.GenerateQuery(fromICAO="LEMD",
                                 toICAO="LEBB",useNAT=False,usePACOT=False,useAWYHI=False)
flightplan = api.plan.generate(query,return_format="native")

When I try to retrieve the route of my flightplan using flightplan.route it says is a NoneType variable. That field is empty.

Why does this happen? When I see the created flight plan on the website, the route is visible.

@PH-KDX PH-KDX self-assigned this Nov 8, 2021
@PH-KDX PH-KDX added bug Something isn't working documentation Improvements or additions to documentation labels Nov 8, 2021
@PH-KDX
Copy link
Owner

PH-KDX commented Nov 8, 2021

Hi,
You're right, just tested it myself.
If I look at the plan generation in the API docs, at https://flightplandatabase.com/dev/api#endpoint-generate, I see that a route is not returned. Unfortunately, since it's not my API or website, I can't change that. I'll send an email to the API maintainer about it, though.
If he doesn't change it, I'll add a note to the library docs in the next release to indicate this.
To work around this, I suggest you take the plan ID as returned by the generate function, and use that to fetch the plan route.

@ElSabio97
Copy link
Author

Thank you for answering so fast. The thing is that I just wanted to use this library because I was looking for a route generator in Python. It looks like there are not so many so this looked excellent for the job.

I just needed something that gives back the name of the fixes and navaids of the route with its coordinates that is all.

I will try to use the search function to try and retrieve the route of a previously created flight plan. Since the inputs are the origin and destination airports.

Also, do you think it could be done by setting return_format to csv? I have tried this but I do not know how that bytes thing works hehe.

@PH-KDX
Copy link
Owner

PH-KDX commented Nov 8, 2021

Unfortunately, the return_format feature is also currently broken on the API side; currently, it always returns a Plan object. I sent an email to the maintainer about it a week ago, but I still haven't gotten a response.
The way it should work, when everything is working as usual, is that when return_format is set to, say, csv, the information is returned in CSV format inside a bytes object instead of as a Plan object, The reason a bytes object is used instead of a string is so that anything which happens to be an escape code in Python does not get escaped in the string conversion.
However, the same information is returned in CSV format as in native format. If the route isn't returned in native format, switching to CSV wouldn't help you in any case.

@ElSabio97
Copy link
Author

Thanks for the help. I will try to retrieve routes from other sources then.

Have a nice day!

@PH-KDX
Copy link
Owner

PH-KDX commented Nov 8, 2021

I do suggest you just use the ID to fetch the route. It means 2 http calls instead of one, but it would probably be easier than completely switching API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants