Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/xyz routes #88

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ venv.bak/
.spyderproject
.spyproject

# Pycharm project settings
.idea

# Rope project settings
.ropeproject

Expand Down
164 changes: 164 additions & 0 deletions examples/xyz_client.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 11,
"id": "2c97c6a5",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "478f19334e2c432c98b09dab29b4071b",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[39, -105.121558], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoo…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from ipyleaflet import Map, LocalTileLayer\n",
"from ipywidgets import Layout\n",
"defaultLayout=Layout(width='960px', height='540px')\n",
"\n",
"m = Map(center=(39, -105.121558), zoom=2, layout=defaultLayout)\n",
"m.add_layer(LocalTileLayer(path='http://127.0.0.1:9000/tiles/air/{z}/{x}/{y}'))\n",
"\n",
"m"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "1c9d35f6",
"metadata": {},
"outputs": [],
"source": [
"from traitlets import Unicode\n",
"from ipyleaflet import Map, WMSLayer, basemaps\n",
"from ipyleaflet import Map, LocalTileLayer\n",
"from ipywidgets import Layout\n",
"defaultLayout=Layout(width='960px', height='540px')\n",
"\n",
"\n",
"class TimeWMTSLayer(LocalTileLayer):\n",
"\n",
" time = Unicode('').tag(sync=True, o=True)\n",
"\n",
"\n",
" \n",
"wmts = TimeWMTSLayer(path='http://127.0.0.1:9000/tiles/air/{time}/{z}/{x}/{y}')\n",
" \n",
" \n",
"m = Map(basemap=basemaps.CartoDB.Positron, center=(39, -105.121558), zoom=2, layout=defaultLayout)\n",
"\n",
"m.add_layer(wmts)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "4a84ba22",
"metadata": {},
"outputs": [],
"source": [
"from ipywidgets import SelectionSlider\n",
"from pandas import date_range\n",
"\n",
"times = date_range(\"2013-01-01\",\"2013-12-31\",freq=\"6H\").strftime(\"%Y-%m-%dT%H:%M\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "44be1ef0",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e2f486ca87ef45b2a08e7f451d3995a1",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"SelectionSlider(description='Time:', options=('2013-01-01T00:00', '2013-01-01T06:00', '2013-01-01T12:00', '201…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"slider = SelectionSlider(description='Time:', options=times)\n",
"\n",
"def update_wms(change):\n",
" wmts.time = '{}'.format(slider.value)\n",
" wmts.redraw()\n",
"\n",
"\n",
"slider.observe(update_wms, 'value')\n",
"slider"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "cc28cc1f",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "73bc3dfbe6b54c2da9294624c77516ba",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[39, -105.121558], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoo…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"m"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "979a7391",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "xpublish",
"language": "python",
"name": "xpublish"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading