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

Add support for OrthographicView #375

Open
cornhundred opened this issue Feb 20, 2024 · 3 comments
Open

Add support for OrthographicView #375

cornhundred opened this issue Feb 20, 2024 · 3 comments

Comments

@cornhundred
Copy link

Context

I would like to visualize non geographic data (e.g., spatial multi-omic biological data) using lonboard. I belive that we would have the add the option for the OrthographicView class in deck.gl.

Issue

I think that we just need to expose the view classes to lonboard to allow users to use the OrthograhicView.

Acceptance-Criteria

I'm not sure what these would be.

@kylebarron
Copy link
Member

This is related to #322.

I think that View is always passed in to Deck directly, not the Layer class, right? In that case it should be relatively simple.

As a general statement, much of lonboard so far has geospatial assumptions baked in, but I think nothing should preclude using non-geospatial data

@cornhundred
Copy link
Author

Thanks, that is my understanding too that it is passed into Deck directly.

Here's how I'm setting the view on an ObservableHQ notebook

const view = new deck.OrthographicView({id: 'ortho'})

deck.DeckGL({
    container,
    views:[view],
    initialViewState:INITIAL_VIEW_STATE,
    controller: true,
  });

I can have a look at lonboard to see if I can figure out how to make a pull request.

@kylebarron
Copy link
Member

A PR would be great. In general, models are defined first in TS https://github.com/developmentseed/lonboard/blob/main/src/model/layer.ts (maybe create a new file for view.ts?), then create wrapper classes (subclassing from ipywidgets.Widget) that map to the deck.gl api:

lonboard/lonboard/_layer.py

Lines 288 to 357 in 4daca9b

class BitmapLayer(BaseLayer):
"""
The `BitmapLayer` renders a bitmap (e.g. PNG, JPEG, or WebP) at specified
boundaries.
**Example:**
```py
from lonboard import Map, BitmapLayer
layer = BitmapLayer(
image='https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/sf-districts.png',
bounds=[-122.5190, 37.7045, -122.355, 37.829]
)
m = Map(layer)
m
```
"""
_layer_type = traitlets.Unicode("bitmap").tag(sync=True)
image = traitlets.Unicode().tag(sync=True)
"""The URL to an image to display.
- Type: `str`
"""
bounds = traitlets.Union(
[
traitlets.List(traitlets.Float(), minlen=4, maxlen=4),
traitlets.List(
traitlets.List(traitlets.Float(), minlen=2, maxlen=2),
minlen=4,
maxlen=4,
),
]
).tag(sync=True)
"""The bounds of the image.
Supported formats:
- Coordinates of the bounding box of the bitmap `[left, bottom, right, top]`
- Coordinates of four corners of the bitmap, should follow the sequence of
`[[left, bottom], [left, top], [right, top], [right, bottom]]`.
"""
desaturate = traitlets.Float(0, min=0, max=1).tag(sync=True)
"""The desaturation of the bitmap. Between `[0, 1]`.
- Type: `float`, optional
- Default: `0`
"""
transparent_color = traitlets.List(
traitlets.Float(), default_value=None, allow_none=True, minlen=3, maxlen=4
)
"""The color to use for transparent pixels, in `[r, g, b, a]`.
- Type: `List[float]`, optional
- Default: `[0, 0, 0, 0]`
"""
tint_color = traitlets.List(
traitlets.Float(), default_value=None, allow_none=True, minlen=3, maxlen=4
)
"""The color to tint the bitmap by, in `[r, g, b]`.
- Type: `List[float]`, optional
- Default: `[255, 255, 255]`
"""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants