Skip to content

Commit

Permalink
Deployed 9558a33 with MkDocs version: 1.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Kuethe committed Jan 3, 2024
1 parent 0b3db95 commit 11ba010
Show file tree
Hide file tree
Showing 29 changed files with 10,693 additions and 2,464 deletions.
495 changes: 482 additions & 13 deletions 404.html

Large diffs are not rendered by default.

943 changes: 943 additions & 0 deletions api/basemaps/index.html

Large diffs are not rendered by default.

1,412 changes: 1,412 additions & 0 deletions api/controls/index.html

Large diffs are not rendered by default.

1,236 changes: 1,236 additions & 0 deletions api/layer/index.html

Large diffs are not rendered by default.

2,191 changes: 2,191 additions & 0 deletions api/map/index.html

Large diffs are not rendered by default.

1,044 changes: 1,044 additions & 0 deletions api/sources/index.html

Large diffs are not rendered by default.

Binary file not shown.
Binary file added examples/airports/__pycache__/app.cpython-39.pyc
Binary file not shown.
Binary file added examples/airports/__pycache__/app2.cpython-39.pyc
Binary file not shown.
Binary file added examples/airports/__pycache__/app3.cpython-39.pyc
Binary file not shown.
Binary file added examples/airports/__pycache__/app4.cpython-39.pyc
Binary file not shown.
94 changes: 94 additions & 0 deletions examples/airports/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import pandas as pd
from pymaplibregl import (
Layer,
LayerType,
Map,
MapOptions,
output_maplibregl,
render_maplibregl,
)
from pymaplibregl.basemaps import Carto
from pymaplibregl.controls import Marker, MarkerOptions, Popup, PopupOptions
from pymaplibregl.sources import GeoJSONSource
from pymaplibregl.utils import GeometryType, df_to_geojson
from shiny import App, ui

BOUNDS = (-8.92242886, 43.30508298, 13.76496714, 59.87668996)

airports_data = pd.read_json(
"https://github.com/visgl/deck.gl-data/raw/master/examples/line/airports.json"
)


def get_color(airport_type: str) -> str:
color = "darkblue"
if airport_type == "mid":
color = "darkred"
elif airport_type == "major":
color = "darkgreen"

return color


geojson = df_to_geojson(
airports_data,
"coordinates",
GeometryType.POINT,
properties=["type", "name", "abbrev"],
)

airport_circles = Layer(
type=LayerType.CIRCLE,
source=GeoJSONSource(data=geojson),
paint={
"circle-color": [
"match",
["get", "type"],
"mid",
"darkred",
"major",
"darkgreen",
"darkblue",
],
"circle_radius": 10,
"circle-opacity": 0.3,
},
)

map_options = MapOptions(
style=Carto.POSITRON,
bounds=BOUNDS,
fit_bounds_options={"padding": 20},
hash=True,
)

popup_options = PopupOptions(close_button=False)

app_ui = ui.page_fluid(
ui.panel_title("Airports"),
output_maplibregl("maplibre", height=600),
)


def server(input, output, session):
@render_maplibregl
async def maplibre():
m = Map(map_options)
for _, r in airports_data.iterrows():
marker = Marker(
lng_lat=r["coordinates"],
options=MarkerOptions(color=get_color(r["type"])),
popup=Popup(
text=r["name"],
options=popup_options,
),
)
m.add_marker(marker)
m.add_layer(airport_circles)
return m


app = App(app_ui, server)

if __name__ == "__main__":
app.run()
Loading

0 comments on commit 11ba010

Please sign in to comment.