From 5c7983ecad88d66d6e609fbc9045ed01a2dd0c1a Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Sun, 21 Jan 2024 11:13:07 +0100 Subject: [PATCH] Update examples --- docs/examples/3d_indoor_mapping/index.md | 4 +- docs/examples/geopandas/index.md | 4 +- docs/examples/road_safety/app.html | 167 +++++++++++++++++++++++ docs/examples/road_safety/app.py | 7 +- docs/examples/road_safety/index.md | 2 + docs/examples/vancouver_blocks/index.md | 4 +- 6 files changed, 179 insertions(+), 9 deletions(-) create mode 100644 docs/examples/road_safety/app.html diff --git a/docs/examples/3d_indoor_mapping/index.md b/docs/examples/3d_indoor_mapping/index.md index 3219f96b..9f231f34 100644 --- a/docs/examples/3d_indoor_mapping/index.md +++ b/docs/examples/3d_indoor_mapping/index.md @@ -1,9 +1,9 @@ +See example in action + ```python -8<-- "3d_indoor_mapping/app.py" ``` -See example in action - Run example: ``` bash diff --git a/docs/examples/geopandas/index.md b/docs/examples/geopandas/index.md index de01d4b2..fffccb96 100644 --- a/docs/examples/geopandas/index.md +++ b/docs/examples/geopandas/index.md @@ -1,9 +1,9 @@ +See example in action + ```python -8<-- "geopandas/app.py" ``` -See example in action - Run example: ``` bash diff --git a/docs/examples/road_safety/app.html b/docs/examples/road_safety/app.html new file mode 100644 index 00000000..1482e9a7 --- /dev/null +++ b/docs/examples/road_safety/app.html @@ -0,0 +1,167 @@ + + + +Pymaplibregl + + + + +
+ + + \ No newline at end of file diff --git a/docs/examples/road_safety/app.py b/docs/examples/road_safety/app.py index b79786f7..2e8b9c8d 100644 --- a/docs/examples/road_safety/app.py +++ b/docs/examples/road_safety/app.py @@ -1,3 +1,4 @@ +import sys import webbrowser import h3 @@ -15,7 +16,7 @@ from maplibre.utils import df_to_geojson from shiny import App, reactive, ui -RESOLUTION = 6 +RESOLUTION = 7 COLORS = ( "lightblue", "turquoise", @@ -94,9 +95,9 @@ async def resolution(): app = App(app_ui, server) if __name__ == "__main__": - filename = "/tmp/road_safety.html" + filename = sys.argv[1] if len(sys.argv) == 2 else "/tmp/road_safety.html" with open(filename, "w") as f: m = create_map() - f.write(m.to_html()) + f.write(m.to_html(style="height: 700px;")) webbrowser.open(filename) diff --git a/docs/examples/road_safety/index.md b/docs/examples/road_safety/index.md index e7ac5483..4173e20c 100644 --- a/docs/examples/road_safety/index.md +++ b/docs/examples/road_safety/index.md @@ -1,3 +1,5 @@ +See example in action (without reactive effects) + ```python -8<-- "road_safety/app.py" ``` diff --git a/docs/examples/vancouver_blocks/index.md b/docs/examples/vancouver_blocks/index.md index 0afed974..5af20d82 100644 --- a/docs/examples/vancouver_blocks/index.md +++ b/docs/examples/vancouver_blocks/index.md @@ -1,9 +1,9 @@ +See example in action (without reactive effects) + ```python -8<-- "vancouver_blocks/app.py" ``` -See example in action (without reactive effects) - Run example: ```bash