xoolive/traffic

Airport.geoencode not working

Closed this issue · 9 comments

Hi,

The request to get the airport details using airports["JFK"].geoencode(runways=True, labels=True) does not work. It outputs a blank cell on jupyter or colab notebook. I have tried running this command before and it used to work (a couple of months ago).

Thank you for the help,
Sasha

Thank you Sasha for your interest in the library.

About your problem, I suspect a problem in your Jupyter configuration, unrelated to the traffic library. Could you check whether a regular altair sample code works properly?
https://altair-viz.github.io/getting_started/starting.html

Thank you Xavier for your support.
It turns out that a regular altair sample code works well.

Also, the airports.geonencode request seems the only not working. The other plot like Flight Information Region work. What is weird is that I have exactly the same trouble using google colab or python on my desktop.

I am using version 4.1 of altair

Thank you :)
Sasha

On my side, it seems that the CSV file from ourairports.com is now empty! (an issue on their side)

Can you try airports.data and check the content of the dataframe? If this is the problem, I will implement a fallback and upload a fix quickly...

Xavier

The problem seems fixed on the ourairports.com side and I was able to reproduce the issue you mentioned. For now you can do

airports["JFK"].geoencode(False, True, True) 

But there seems to be a bug with the full openstreetmap layout. I will investigate that.

Thank you for your help Xavier.
The airports["JFK"].geoencode(False, True, True) does work now.

In the meantime, I troubleshooted the bug using python on my desktop (Spyder) with the altair_viewer library. The graphs are being displayed on a local webpage and it works fine.

Thanks again,
Sasha

Following up, it seems there is an issue with altair and Polygons which appear as big full squares. LineStrings work fine. I am still not sure whether the geojson is faulty (e.g. airports['KJFK'].geojson()) or whether it is a bug in altair/vega.

At Version 2.3 @xoolive's temporary solution worked. It's just missing the Layout of OSM.

  • airports["AMS"].geoencode(runways=True, labels=True): -> Blank Cell
  • airports["AMS"].geoencode(False, True, True): ->
    visualization

But in the current commit 95e9ff5 it seems the method something with the definition of geoencode() went wrong.

  • airports["AMS"].geoencode(runways=True, labels=True) and airports["AMS"].geoencode(False, True, True) :
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-6-be0fee99b63c> in <module>
----> 1 airports["LFBO"].geoencode(runways=True, labels=True)

~/.conda/envs/thead/lib/python3.8/site-packages/traffic-2.4.1-py3.8.egg/traffic/core/structure.py in geoencode(self, footprint, runways, labels)
    129             cumul.append(self.runways.geoencode())
    130         if labels:
--> 131             cumul.append(self.runways.geoencode("labels"))
    132         if len(cumul) == 0:
    133             raise TypeError(

TypeError: geoencode() takes 1 positional argument but 2 were given

woops, thanks @develmusa !
I remember when I edited this and mypy didn't shout :/

In the meantime, I changed default parameters for airports, without OSM layout, but with runways and labels. Will revert when things get clearer with altair and polygons.

Closing for now then, sorry for the inconvenience

@develmusa @sashamadar found out the issue by chance today (the best way to solve problems is probably to not try...), reopening then pushing a fix