Skip to content

Commit cfd7054

Browse files
author
Stefan Kuethe
committed
Add layer example
1 parent 8b3c961 commit cfd7054

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/concepts/layers.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,23 @@ const style = {
4646
```
4747

4848
> See [Styles API](../../api/styles/) and [ol/style/flat](https://openlayers.org/en/latest/apidoc/module-ol_style_flat.html) for details.
49+
50+
```python {marimo display_code=true}
51+
import openlayers as ol
52+
53+
data = "https://openlayers.org/en/latest/examples/data/geojson/roads-seoul.geojson"
54+
55+
vector = ol.VectorLayer(
56+
id="roads",
57+
source=ol.VectorSource(url=data),
58+
fit_bounds=True,
59+
style=ol.FlatStyle(
60+
stroke_color = "steelblue",
61+
stroke_width = 3.5
62+
)
63+
)
64+
65+
m = ol.MapWidget(layers=[ol.BasemapLayer(), vector])
66+
m.add_default_tooltip()
67+
m
68+
```

0 commit comments

Comments
 (0)