Skip to content
Snippets Groups Projects
Verified Commit 120ad7fb authored by Alexander Dunkel's avatar Alexander Dunkel
Browse files

refactor: improve DRY

parent 03cdb561
No related branches found
No related tags found
No related merge requests found
...@@ -1130,16 +1130,6 @@ gv_layers = hv.Overlay( ...@@ -1130,16 +1130,6 @@ gv_layers = hv.Overlay(
) )
``` ```
```python
places_layer.opts(
tools=['hover'],
size=20,
line_color='black',
line_width=0.1,
fill_alpha=0.8,
fill_color='red')
```
<div class="alert alert-info" role="alert" style="color: black;"> <div class="alert alert-info" role="alert" style="color: black;">
<details><summary><strong>Combining Layers</strong></summary> <details><summary><strong>Combining Layers</strong></summary>
<div style="width:500px"> <div style="width:500px">
...@@ -1158,29 +1148,29 @@ places_layer.opts( ...@@ -1158,29 +1148,29 @@ places_layer.opts(
**Display map** **Display map**
```python ```python
gv_layers.opts( layer_options = {
projection=ccrs.GOOGLE_MERCATOR, "projection":ccrs.GOOGLE_MERCATOR,
title=df.loc[0, "name"], "title":df.loc[0, "name"],
responsive=True, "responsive":True,
xlim=(bbox_bottomleft[0], bbox_topright[0]), "xlim":(bbox_bottomleft[0], bbox_topright[0]),
ylim=(bbox_bottomleft[1], bbox_topright[1]), "ylim":(bbox_bottomleft[1], bbox_topright[1]),
data_aspect=0.45, # maintain fixed aspect ratio during responsive resize "data_aspect":0.45, # maintain fixed aspect ratio during responsive resize
hooks=[set_active_tool]) "hooks":[set_active_tool]
}
```
```python
gv_layers.opts(**layer_options)
``` ```
**Store map as static HTML file** **Store map as static HTML file**
Unset `data_aspect` and store standalone HTML file that automatically resizes to full height of browser:
```python ```python
gv_layers.opts( layer_options["data_aspect"] = None
projection=ccrs.GOOGLE_MERCATOR,
title=df.loc[0, "name"],
responsive=True,
xlim=(bbox_bottomleft[0], bbox_topright[0]),
ylim=(bbox_bottomleft[1], bbox_topright[1]),
data_aspect=0.45, # maintain fixed aspect ratio during responsive resize
hooks=[set_active_tool])
hv.save( hv.save(
gv_layers, OUTPUT / f'geoviews_map.html', backend='bokeh') gv_layers.opts(**layer_options), OUTPUT / f'geoviews_map.html', backend='bokeh')
``` ```
<div class="alert alert-warning" role="alert" style="color: black;"> <div class="alert alert-warning" role="alert" style="color: black;">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment