Skip to content

Commit cf2c5fe

Browse files
authored
chore: Make GlobeView experimental (#1038)
There are just too many upstream bugs with `GlobeView` to call it stable, such as #1037. For now we'll cut the release with globe view as experimental.
1 parent 74655f0 commit cf2c5fe

File tree

8 files changed

+18
-40
lines changed

8 files changed

+18
-40
lines changed

docs/api/controls.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
# lonboard.controls
22

3-
::: lonboard.controls.BaseControl
4-
::: lonboard.controls.FullscreenControl
5-
::: lonboard.controls.NavigationControl
6-
::: lonboard.controls.ScaleControl
7-
8-
::: lonboard.controls.MultiRangeSlider
3+
::: lonboard.controls

docs/api/view.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# lonboard.view
1+
# lonboard.experimental.view
22

3-
::: lonboard.view
3+
::: lonboard.experimental.view
44
options:
55
members_order: source

lonboard/_map.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
NavigationControl,
2020
ScaleControl,
2121
)
22+
from lonboard.experimental.view import BaseView, GlobeView, MapView
2223
from lonboard.layer import BaseLayer
2324
from lonboard.traits import MapHeightTrait, VariableLengthTuple, ViewStateTrait
24-
from lonboard.view import BaseView, GlobeView, MapView
2525
from lonboard.view_state import BaseViewState, GlobeViewState, MapViewState
2626

2727
if TYPE_CHECKING:
@@ -73,17 +73,6 @@ class Map(BaseAnyWidget):
7373
7474
m = Map([point_layer, polygon_layer])
7575
```
76-
77-
**Example:** Creating a Map with GlobeView:
78-
79-
```py
80-
import geopandas as gpd
81-
from lonboard import Map
82-
from lonboard.view import GlobeView
83-
84-
# Continuing from above example
85-
m = Map([point_layer, polygon_layer], view=GlobeView())
86-
```
8776
"""
8877

8978
def __init__(
@@ -229,7 +218,10 @@ def on_click(self, callback: Callable, *, remove: bool = False) -> None:
229218
sync=True,
230219
**ipywidgets.widget_serialization,
231220
)
232-
"""One or more map controls to display on this map."""
221+
"""One or more map controls to display on this map.
222+
223+
See [`lonboard.controls`][] for available controls.
224+
"""
233225

234226
view: t.Instance[BaseView | None] = t.Instance(BaseView, allow_none=True).tag(
235227
sync=True,
@@ -239,7 +231,7 @@ def on_click(self, callback: Callable, *, remove: bool = False) -> None:
239231
240232
Views represent the "camera(s)" (essentially viewport dimensions and projection matrices) that you look at your data with. deck.gl offers multiple view types for both geospatial and non-geospatial use cases. Read the [Views and Projections](https://deck.gl/docs/developer-guide/views) guide for the concept and examples.
241233
242-
See [`lonboard.view`][lonboard.view] for available view types.
234+
See [`lonboard.experimental.view`][] for available view types.
243235
"""
244236

245237
@t.validate("view")

lonboard/_viz.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import json
88
from textwrap import dedent
9-
from typing import TYPE_CHECKING, Any, Literal, Protocol, TypeAlias, cast
9+
from typing import TYPE_CHECKING, Any, Protocol, TypeAlias, cast
1010

1111
import numpy as np
1212
from arro3.core import Array, ChunkedArray, Schema, Table, struct_field
@@ -26,7 +26,6 @@
2626
)
2727
from lonboard.basemap import CartoStyle, MaplibreBasemap
2828
from lonboard.layer import PathLayer, PolygonLayer, ScatterplotLayer
29-
from lonboard.view import BaseView, GlobeView
3029

3130
if TYPE_CHECKING:
3231
import duckdb
@@ -82,14 +81,13 @@ def __geo_interface__(self) -> dict: ...
8281
DEFAULT_POLYGON_LINE_COLOR = [0, 0, 0, 200]
8382

8483

85-
def viz( # noqa: PLR0913
84+
def viz(
8685
data: VizDataInput | list[VizDataInput] | tuple[VizDataInput, ...],
8786
*,
8887
scatterplot_kwargs: ScatterplotLayerKwargs | None = None,
8988
path_kwargs: PathLayerKwargs | None = None,
9089
polygon_kwargs: PolygonLayerKwargs | None = None,
9190
map_kwargs: MapKwargs | None = None,
92-
view: BaseView | Literal["globe"] | None = None,
9391
) -> Map:
9492
"""Plot your data easily.
9593
@@ -168,7 +166,6 @@ def viz( # noqa: PLR0913
168166
[`PolygonLayer`][lonboard.PolygonLayer]s.
169167
map_kwargs: a `dict` of parameters to pass down to the generated
170168
[`Map`][lonboard.Map].
171-
view: a [view instance][lonboard.view.BaseView] to use for the map view, or the string "globe".
172169
173170
For more control over rendering, construct [`Map`][lonboard.Map] and `Layer` objects
174171
directly.
@@ -204,12 +201,6 @@ def viz( # noqa: PLR0913
204201

205202
map_kwargs = map_kwargs if map_kwargs else {}
206203

207-
if "view" not in map_kwargs and view is not None:
208-
if view == "globe":
209-
map_kwargs["view"] = GlobeView()
210-
else:
211-
map_kwargs["view"] = view
212-
213204
if "basemap_style" not in map_kwargs and "basemap" not in map_kwargs:
214205
map_kwargs["basemap"] = MaplibreBasemap(
215206
mode="interleaved",

lonboard/view_state.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class BaseViewState:
99

1010
@dataclass(frozen=True)
1111
class MapViewState(BaseViewState):
12-
"""State of a [MapView][lonboard.view.MapView]."""
12+
"""State of a [MapView][lonboard.experimental.view.MapView]."""
1313

1414
longitude: float = 0
1515
"""longitude at the map center"""
@@ -41,7 +41,7 @@ class MapViewState(BaseViewState):
4141

4242
@dataclass(frozen=True)
4343
class GlobeViewState(BaseViewState):
44-
"""State of a [GlobeView][lonboard.view.GlobeView]."""
44+
"""State of a [GlobeView][lonboard.experimental.view.GlobeView]."""
4545

4646
longitude: float
4747
"""longitude at the viewport center."""
@@ -61,7 +61,7 @@ class GlobeViewState(BaseViewState):
6161

6262
@dataclass(frozen=True)
6363
class FirstPersonViewState(BaseViewState):
64-
"""State of a [FirstPersonView][lonboard.view.FirstPersonView]."""
64+
"""State of a [FirstPersonView][lonboard.experimental.view.FirstPersonView]."""
6565

6666
longitude: float
6767
"""longitude of the camera position."""
@@ -87,7 +87,7 @@ class FirstPersonViewState(BaseViewState):
8787

8888
@dataclass(frozen=True)
8989
class OrthographicViewState(BaseViewState):
90-
"""State of an [OrthographicView][lonboard.view.OrthographicView]."""
90+
"""State of an [OrthographicView][lonboard.experimental.view.OrthographicView]."""
9191

9292
target: tuple[float, float, float] = (0.0, 0.0, 0.0)
9393
"""The world position at the center of the viewport."""
@@ -111,7 +111,7 @@ class OrthographicViewState(BaseViewState):
111111

112112
@dataclass(frozen=True)
113113
class OrbitViewState(BaseViewState):
114-
"""State of an [OrbitView][lonboard.view.OrbitView]."""
114+
"""State of an [OrbitView][lonboard.experimental.view.OrbitView]."""
115115

116116
target: tuple[float, float, float] = (0.0, 0.0, 0.0)
117117
"""The world position at the center of the viewport."""

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ nav:
8787
- api/colormap.md
8888
- api/controls.md
8989
- api/traits.md
90-
- api/view.md
9190
- api/view_state.md
9291
- Experimental:
92+
- api/view.md
9393
- Layers:
9494
- api/layers/text-layer.md
9595
- cli.md

tests/test_map.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from lonboard import Map, ScatterplotLayer, SolidPolygonLayer, viz
77
from lonboard.basemap import MaplibreBasemap
8-
from lonboard.view import FirstPersonView, GlobeView, OrthographicView
8+
from lonboard.experimental.view import FirstPersonView, GlobeView, OrthographicView
99
from lonboard.view_state import (
1010
FirstPersonViewState,
1111
GlobeViewState,

0 commit comments

Comments
 (0)