diff --git a/content/notebooks/17_vector_tile_layer.ipynb b/content/notebooks/17_vector_tile_layer.ipynb index b3a73e8..481db67 100644 --- a/content/notebooks/17_vector_tile_layer.ipynb +++ b/content/notebooks/17_vector_tile_layer.ipynb @@ -52,7 +52,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map()" + "m = leafmap.Map(center=(52.204793, 360.121558), zoom=9)" ] }, { @@ -91,7 +91,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "One can customize the vector tile layer style if needed. More info can be found at https://ipyleaflet.readthedocs.io/en/latest/api_reference/vector_tile.html" + "One can customize the vector tile layer style if needed. More info can be found at \n", + "https://ipyleaflet.readthedocs.io/en/latest/layers/vector_tile.html \n", + "\n", + "Conditional styling ([example here](https://github.com/iwpnd/folium-vectorgrid)) currently works only with folium. Use:\n", + "\n", + "```python\n", + "import leafmap.foliumap as leafmap \n", + "```" ] }, { @@ -100,7 +107,122 @@ "metadata": {}, "outputs": [], "source": [ - "vector_tile_layer_styles = {}" + "water_style = dict(\n", + " fill=\"true\",\n", + " weight=1,\n", + " fillColor=\"#06cccc\",\n", + " color=\"#06cccc\",\n", + " fillOpacity=0.2,\n", + " opacity=0.4,\n", + ")\n", + "\n", + "waterway_style = dict(\n", + " weight=1, fillColor=\"#2375e0\", color=\"#2375e0\", fillOpacity=0.2, opacity=0.4\n", + ")\n", + "\n", + "admin_style = dict(\n", + " weight=1, fillColor=\"pink\", color=\"pink\", fillOpacity=0.2, opacity=0.4\n", + ")\n", + "\n", + "landcover_style = dict(\n", + " fill=\"true\",\n", + " weight=1,\n", + " fillColor=\"#53e033\",\n", + " color=\"#53e033\",\n", + " fillOpacity=0.2,\n", + " opacity=0.4,\n", + ")\n", + "\n", + "landuse_style = dict(\n", + " fill=\"true\",\n", + " weight=1,\n", + " fillColor=\"#e5b404\",\n", + " color=\"#e5b404\",\n", + " fillOpacity=0.2,\n", + " opacity=0.4,\n", + ")\n", + "\n", + "park_style = dict(\n", + " fill=\"true\",\n", + " weight=1,\n", + " fillColor=\"#84ea5b\",\n", + " color=\"#84ea5b\",\n", + " fillOpacity=0.2,\n", + " opacity=0.4,\n", + ")\n", + "\n", + "boundary_style = dict(\n", + " weight=1, fillColor=\"#c545d3\", color=\"#c545d3\", fillOpacity=0.2, opacity=0.4\n", + ")\n", + "\n", + "\n", + "aeroway = dict(\n", + " weight=1, fillColor=\"#51aeb5\", color=\"#51aeb5\", fillOpacity=0.2, opacity=0.4\n", + ")\n", + "\n", + "road = dict(\n", + " weight=1, fillColor=\"#f2b648\", color=\"#f2b648\", fillOpacity=0.2, opacity=0.4\n", + ")\n", + "\n", + "transit = dict(\n", + " weight=0.5, fillColor=\"#f2b648\", color=\"#f2b648\", fillOpacity=0.2, opacity=0.4\n", + ")\n", + "\n", + "buildings = dict(\n", + " fill=\"true\",\n", + " weight=1,\n", + " fillColor=\"#2b2b2b\",\n", + " color=\"#2b2b2b\",\n", + " fillOpacity=0.2,\n", + " opacity=0.4,\n", + ")\n", + "\n", + "water_name = dict(\n", + " weight=1, fillColor=\"#022c5b\", color=\"#022c5b\", fillOpacity=0.2, opacity=0.4\n", + ")\n", + "\n", + "transportation_name = dict(\n", + " weight=1, fillColor=\"#bc6b38\", color=\"#bc6b38\", fillOpacity=0.2, opacity=0.4\n", + ")\n", + "\n", + "place = dict(\n", + " weight=1, fillColor=\"#f20e93\", color=\"#f20e93\", fillOpacity=0.2, opacity=0.4\n", + ")\n", + "\n", + "housenumber = dict(\n", + " weight=1, fillColor=\"#ef4c8b\", color=\"#ef4c8b\", fillOpacity=0.2, opacity=0.4\n", + ")\n", + "\n", + "poi = dict(weight=1, fillColor=\"#3bb50a\", color=\"#3bb50a\", fillOpacity=0.2, opacity=0.4)\n", + "\n", + "earth = dict(\n", + " fill=\"true\",\n", + " weight=1,\n", + " fillColor=\"#c0c0c0\",\n", + " color=\"#c0c0c0\",\n", + " fillOpacity=0.2,\n", + " opacity=0.4,\n", + ")\n", + "\n", + "vector_tile_layer_styles = dict(\n", + " water=water_style,\n", + " waterway=waterway_style,\n", + " admin=admin_style,\n", + " andcover=landcover_style,\n", + " landuse=landuse_style,\n", + " park=park_style,\n", + " boundaries=boundary_style,\n", + " aeroway=aeroway,\n", + " roads=road,\n", + " transit=transit,\n", + " buildings=buildings,\n", + " water_name=water_name,\n", + " transportation_name=transportation_name,\n", + " places=place,\n", + " housenumber=housenumber,\n", + " pois=poi,\n", + " earth=earth,\n", + ")" ] }, { @@ -116,7 +238,7 @@ "metadata": {}, "outputs": [], "source": [ - "m.add_vector_tile_layer(url, attribution, vector_tile_layer_styles)\n", + "m.add_vector_tile_layer(url, vector_tile_layer_styles, attribution=attribution)\n", "m" ] }