Skip to content

Commit 169f395

Browse files
committed
Add extent to view object
1 parent 9372403 commit 169f395

File tree

3 files changed

+34
-31
lines changed

3 files changed

+34
-31
lines changed

examples/standalone/gpd_fit_bounds.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
# print(gdf)
99
m = gdf.ol.color_category("STATE").explore()
1010
# m.add_call("fitBoundsFromLonLat", list(gdf.total_bounds))
11-
m.fit_bounds(list(gdf.total_bounds))
11+
# m.fit_bounds(list(gdf.total_bounds))
12+
m.set_view(ol.View(extent=list(gdf.total_bounds)))
1213
m.save()

src/openlayers/js/openlayers.anywidget.js

Lines changed: 30 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/openlayers/models/view.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ class View(OLBaseModel):
3636
Attributes:
3737
center (tuple[float, float]): The centerpoint of the map as `(lon, lat)` pair
3838
zoom (float | int): The zoom level of the map
39+
extent (tuple[float, float, float, float] | list[float, float, float, float]): ...
3940
min_zoom (float | int): The minimum zoom level of the map
4041
max_zoom (float | int): The maximum zoom level of the map
4142
"""
4243

4344
center: tuple[float, float] | None = (0, 0)
4445
zoom: float | int | None = 0
4546
projection: str | None = Projection.WEB_MERCATOR
47+
extent: tuple[float, float, float, float] | list[float, float, float, float] | None = None
4648
min_zoom: int | float | None = Field(None, serialization_alias="minZoom")
4749
max_zoom: int | float | None = Field(None, serialization_alias="maxZoom")

0 commit comments

Comments
 (0)