Skip to content

Commit 5c295cc

Browse files
committed
Support mustache templates
1 parent 92830d6 commit 5c295cc

File tree

24 files changed

+430
-95
lines changed

24 files changed

+430
-95
lines changed

examples/standalone/circles.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@
3030

3131
gdf = ol.GeoDataFrame.from_features(features, crs=Projection.MERCATOR)
3232
m = gdf.ol.explore(style=style, controls=[ol.controls.ZoomSliderControl()])
33-
m.add_tooltip(None)
33+
# m.add_default_tooltip()
34+
m.add_tooltip("{{ name }}: {{ pop_max }}")
3435
m.save(preview=True)

examples/standalone/polygons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
countries = ol.WebGLVectorLayer(source=ol.VectorSource(url=url))
77

88
m = ol.Map(layers=[BasemapLayer.carto(), countries])
9-
m.add_tooltip("name")
9+
m.add_tooltip("{{ name }}")
1010
# m.add_tooltip()
1111
m.add_control(ol.controls.ZoomSliderControl())
1212
m.add_control(ol.controls.InfoBox(

notebooks/layers/Untitled.ipynb

Lines changed: 306 additions & 14 deletions
Large diffs are not rendered by default.

src/openlayers/__future__/elements.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from ..models.view import View as ViewModel
22

3-
class View(object):
3+
4+
class View(object):
45
def __init__(self, center: tuple[float, float], **kwargs) -> None:
56
self._model = ViewModel(**(locals() | kwargs))
67

src/openlayers/anywidget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import traitlets
77
from anywidget import AnyWidget
88

9-
from .models.controls import ControlT, LayerT
109
from .map import Map
10+
from .models.controls import ControlT, LayerT
1111
from .models.view import View
1212

1313

src/openlayers/basemaps.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from .models.layers import TileLayer
88
from .models.sources import OSM, ImageTileSource
99

10-
1110
# light_all,
1211
# dark_all,
1312
# light_nolabels,

src/openlayers/config.py

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

66
from pydantic import BaseModel, ConfigDict
77

8-
from .styles import default_style, FlatStyle
8+
from .styles import FlatStyle, default_style
99

1010
"""
1111
DEFAULT_STYLE = {

src/openlayers/controls.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@
88
ZoomSliderControl,
99
)
1010

11-
__all__ = ["FullScreenControl", "InfoBox", "OverviewMapControl", "ScaleLineControl", "ZoomSliderControl"]
11+
__all__ = [
12+
"FullScreenControl",
13+
"InfoBox",
14+
"OverviewMapControl",
15+
"ScaleLineControl",
16+
"ZoomSliderControl",
17+
]

src/openlayers/express.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
class SimpleLayer(object): ...
22

3+
34
class GeoJSONLayer(object): ...
45

6+
57
class TileLayer(object): ...
68

9+
710
class OSMBaseLayer(object): ...

src/openlayers/geopandas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ def explore(
3131
# Create geojson source
3232
feature_collection = gdf_to_geojson(self._gdf)
3333
source = VectorSource(geojson=feature_collection)
34-
34+
3535
# Create layer
3636
layer_class = WebGLVectorLayer if webgl else VectorLayer
3737
layer = layer_class(id=layer_id, style=style, source=source)
38-
38+
3939
# Initialize map instance add add components
4040
m = MapWidget(**kwargs)
4141
m.add_layer(layer)

0 commit comments

Comments
 (0)