developmentseed / lonboard

A Python library for fast, interactive geospatial vector data visualization in Jupyter.
https://developmentseed.org/lonboard/latest/
MIT License
654 stars 33 forks source link

[BUG] Error: no layer supported for trip #680

Closed leonard-psu closed 1 month ago

leonard-psu commented 1 month ago

Context

What results were you expecting?
Animated trails.

Describe any relevant background information. Tried both air-traffic-control and ais-movingpandas notebooks

Resulting behaviour, error message or logs

Describe what happened: Include relevant screenshots, error messages, and logs:

Messages from chrome console:

Error: no layer supported for trip at DF (2e45ea9e-addc-49fa-86d5-e00cd48e271c:3203:44197) at Z1t (2e45ea9e-addc-49fa-86d5-e00cd48e271c:3210:2240) at 2e45ea9e-addc-49fa-86d5-e00cd48e271c:3210:2763

Error: no layer supported for trip at DF (f41eecfd-e191-441c-90a0-e313344a8d27:3203:44197) at Z1t (f41eecfd-e191-441c-90a0-e313344a8d27:3210:2240) at f41eecfd-e191-441c-90a0-e313344a8d27:3210:2763

Maps render, with no layer.

Environment

Steps to reproduce the bug

Describe the actions that led you to encounter the bug. Example:

Running either notebook in examples folder : both air-traffic-control.ipynb and ais-movingpandas.ipynb

kylebarron commented 1 month ago

Error: no layer supported for trip

That looks like you have an old version of Lonboard loaded onto the JavaScript side of the page. This can happen especially if you installed a new version of Lonboard from inside a Jupyter that's already running.

Try restarting your Jupyter server and in particular reloading the chrome tab. https://developmentseed.org/lonboard/latest/troubleshooting/

leonard-psu commented 1 month ago

I kept getting the same message. Ended up rebooting the server, and creating a new conda environment "lonboardv1c". Created a new folder, lonboard_trails2, and did the following steps:

  1. cd D:\lonboard_trails2
  2. git clone https://github.com/developmentseed/lonboard.git
  3. poetry install
  4. jupyter lab

Now I get this error message about static content missing when running the air-traffic notebook.

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[1], line 7
      4 import requests
      5 from arro3.io import read_parquet
----> 7 from lonboard import Map
      8 from lonboard.experimental import TripsLayer

File [D:\lonboard_trails2\lonboard\lonboard\__init__.py:19](file:///D:/lonboard_trails2/lonboard/lonboard/__init__.py#line=18)
      5 from . import colormap, controls, experimental, layer_extension, traits
      6 from ._layer import (
      7     BaseArrowLayer,
      8     BaseLayer,
   (...)
     17     SolidPolygonLayer,
     18 )
---> 19 from ._map import Map
     20 from ._version import __version__
     21 from ._viz import viz

File [D:\lonboard_trails2\lonboard\lonboard\_map.py:58](file:///D:/lonboard_trails2/lonboard/lonboard/_map.py#line=57)
     38 # HTML template to override exported map as 100% height
     39 _HTML_TEMPLATE = """<!DOCTYPE html>
     40 <html lang="en">
     41 <head>
   (...)
     54 </html>
     55 """
---> 58 class Map(BaseAnyWidget):
     59     """
     60     The top-level class used to display a map in a Jupyter Widget.
     61 
   (...)
     83     ```
     84     """
     86     def __init__(
     87         self, layers: Union[BaseLayer, Sequence[BaseLayer]], **kwargs: Unpack[MapKwargs]
     88     ) -> None:

File [~\.conda\envs\lonboardv1c\lib\site-packages\traitlets\traitlets.py:963](http://localhost:8888/lab/tree/examples/~/.conda/envs/lonboardv1c/lib/site-packages/traitlets/traitlets.py#line=962), in MetaHasDescriptors.__new__(mcls, name, bases, classdict, **kwds)
    960         classdict[k] = v()
    961     # ----------------------------------------------------------------
--> 963 return super().__new__(mcls, name, bases, classdict, **kwds)

File [~\.conda\envs\lonboardv1c\lib\site-packages\anywidget\widget.py:70](http://localhost:8888/lab/tree/examples/~/.conda/envs/lonboardv1c/lib/site-packages/anywidget/widget.py#line=69), in AnyWidget.__init_subclass__(cls, **kwargs)
     67 super().__init_subclass__(**kwargs)
     68 for key in (_ESM_KEY, _CSS_KEY) & cls.__dict__.keys():
     69     # TODO: Upgrate to := when we drop Python 3.7
---> 70     file_contents = try_file_contents(getattr(cls, key))
     71     if file_contents:
     72         setattr(cls, key, file_contents)

File [~\.conda\envs\lonboardv1c\lib\site-packages\anywidget\_util.py:264](http://localhost:8888/lab/tree/examples/~/.conda/envs/lonboardv1c/lib/site-packages/anywidget/_util.py#line=263), in try_file_contents(x)
    262 path = maybe_path
    263 if not path.is_file():
--> 264     raise FileNotFoundError(f"File not found: {path}")
    265 return FileContents(
    266     path=path,
    267     start_thread=_should_start_thread(path),
    268 )

FileNotFoundError: File not found: [D:\lonboard_trails2\lonboard\lonboard\static\index.css](file:///D:/lonboard_trails2/lonboard/lonboard/static/index.css)
kylebarron commented 1 month ago

Unless you need to use the development version, you should install from pip. Otherwise you need to build the JS code: https://github.com/developmentseed/lonboard/blob/main/DEVELOP.md

leonard-psu commented 1 month ago

Thank you, working now.