|
52 | 52 | "metadata": {},
|
53 | 53 | "outputs": [],
|
54 | 54 | "source": [
|
55 |
| - "m = leafmap.Map()" |
| 55 | + "m = leafmap.Map(center=(52.204793, 360.121558), zoom=9)" |
56 | 56 | ]
|
57 | 57 | },
|
58 | 58 | {
|
|
91 | 91 | "cell_type": "markdown",
|
92 | 92 | "metadata": {},
|
93 | 93 | "source": [
|
94 |
| - "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" |
| 94 | + "One can customize the vector tile layer style if needed. More info can be found at \n", |
| 95 | + "https://ipyleaflet.readthedocs.io/en/latest/layers/vector_tile.html \n", |
| 96 | + "\n", |
| 97 | + "Conditional styling ([example here](https://github.com/iwpnd/folium-vectorgrid)) currently works only with folium. Use:\n", |
| 98 | + "\n", |
| 99 | + "```python\n", |
| 100 | + "import leafmap.foliumap as leafmap \n", |
| 101 | + "```" |
95 | 102 | ]
|
96 | 103 | },
|
97 | 104 | {
|
|
100 | 107 | "metadata": {},
|
101 | 108 | "outputs": [],
|
102 | 109 | "source": [
|
103 |
| - "vector_tile_layer_styles = {}" |
| 110 | + "water_style = dict(\n", |
| 111 | + " fill=\"true\",\n", |
| 112 | + " weight=1,\n", |
| 113 | + " fillColor=\"#06cccc\",\n", |
| 114 | + " color=\"#06cccc\",\n", |
| 115 | + " fillOpacity=0.2,\n", |
| 116 | + " opacity=0.4,\n", |
| 117 | + ")\n", |
| 118 | + "\n", |
| 119 | + "waterway_style = dict(\n", |
| 120 | + " weight=1, fillColor=\"#2375e0\", color=\"#2375e0\", fillOpacity=0.2, opacity=0.4\n", |
| 121 | + ")\n", |
| 122 | + "\n", |
| 123 | + "admin_style = dict(\n", |
| 124 | + " weight=1, fillColor=\"pink\", color=\"pink\", fillOpacity=0.2, opacity=0.4\n", |
| 125 | + ")\n", |
| 126 | + "\n", |
| 127 | + "landcover_style = dict(\n", |
| 128 | + " fill=\"true\",\n", |
| 129 | + " weight=1,\n", |
| 130 | + " fillColor=\"#53e033\",\n", |
| 131 | + " color=\"#53e033\",\n", |
| 132 | + " fillOpacity=0.2,\n", |
| 133 | + " opacity=0.4,\n", |
| 134 | + ")\n", |
| 135 | + "\n", |
| 136 | + "landuse_style = dict(\n", |
| 137 | + " fill=\"true\",\n", |
| 138 | + " weight=1,\n", |
| 139 | + " fillColor=\"#e5b404\",\n", |
| 140 | + " color=\"#e5b404\",\n", |
| 141 | + " fillOpacity=0.2,\n", |
| 142 | + " opacity=0.4,\n", |
| 143 | + ")\n", |
| 144 | + "\n", |
| 145 | + "park_style = dict(\n", |
| 146 | + " fill=\"true\",\n", |
| 147 | + " weight=1,\n", |
| 148 | + " fillColor=\"#84ea5b\",\n", |
| 149 | + " color=\"#84ea5b\",\n", |
| 150 | + " fillOpacity=0.2,\n", |
| 151 | + " opacity=0.4,\n", |
| 152 | + ")\n", |
| 153 | + "\n", |
| 154 | + "boundary_style = dict(\n", |
| 155 | + " weight=1, fillColor=\"#c545d3\", color=\"#c545d3\", fillOpacity=0.2, opacity=0.4\n", |
| 156 | + ")\n", |
| 157 | + "\n", |
| 158 | + "\n", |
| 159 | + "aeroway = dict(\n", |
| 160 | + " weight=1, fillColor=\"#51aeb5\", color=\"#51aeb5\", fillOpacity=0.2, opacity=0.4\n", |
| 161 | + ")\n", |
| 162 | + "\n", |
| 163 | + "road = dict(\n", |
| 164 | + " weight=1, fillColor=\"#f2b648\", color=\"#f2b648\", fillOpacity=0.2, opacity=0.4\n", |
| 165 | + ")\n", |
| 166 | + "\n", |
| 167 | + "transit = dict(\n", |
| 168 | + " weight=0.5, fillColor=\"#f2b648\", color=\"#f2b648\", fillOpacity=0.2, opacity=0.4\n", |
| 169 | + ")\n", |
| 170 | + "\n", |
| 171 | + "buildings = dict(\n", |
| 172 | + " fill=\"true\",\n", |
| 173 | + " weight=1,\n", |
| 174 | + " fillColor=\"#2b2b2b\",\n", |
| 175 | + " color=\"#2b2b2b\",\n", |
| 176 | + " fillOpacity=0.2,\n", |
| 177 | + " opacity=0.4,\n", |
| 178 | + ")\n", |
| 179 | + "\n", |
| 180 | + "water_name = dict(\n", |
| 181 | + " weight=1, fillColor=\"#022c5b\", color=\"#022c5b\", fillOpacity=0.2, opacity=0.4\n", |
| 182 | + ")\n", |
| 183 | + "\n", |
| 184 | + "transportation_name = dict(\n", |
| 185 | + " weight=1, fillColor=\"#bc6b38\", color=\"#bc6b38\", fillOpacity=0.2, opacity=0.4\n", |
| 186 | + ")\n", |
| 187 | + "\n", |
| 188 | + "place = dict(\n", |
| 189 | + " weight=1, fillColor=\"#f20e93\", color=\"#f20e93\", fillOpacity=0.2, opacity=0.4\n", |
| 190 | + ")\n", |
| 191 | + "\n", |
| 192 | + "housenumber = dict(\n", |
| 193 | + " weight=1, fillColor=\"#ef4c8b\", color=\"#ef4c8b\", fillOpacity=0.2, opacity=0.4\n", |
| 194 | + ")\n", |
| 195 | + "\n", |
| 196 | + "poi = dict(weight=1, fillColor=\"#3bb50a\", color=\"#3bb50a\", fillOpacity=0.2, opacity=0.4)\n", |
| 197 | + "\n", |
| 198 | + "earth = dict(\n", |
| 199 | + " fill=\"true\",\n", |
| 200 | + " weight=1,\n", |
| 201 | + " fillColor=\"#c0c0c0\",\n", |
| 202 | + " color=\"#c0c0c0\",\n", |
| 203 | + " fillOpacity=0.2,\n", |
| 204 | + " opacity=0.4,\n", |
| 205 | + ")\n", |
| 206 | + "\n", |
| 207 | + "vector_tile_layer_styles = dict(\n", |
| 208 | + " water=water_style,\n", |
| 209 | + " waterway=waterway_style,\n", |
| 210 | + " admin=admin_style,\n", |
| 211 | + " andcover=landcover_style,\n", |
| 212 | + " landuse=landuse_style,\n", |
| 213 | + " park=park_style,\n", |
| 214 | + " boundaries=boundary_style,\n", |
| 215 | + " aeroway=aeroway,\n", |
| 216 | + " roads=road,\n", |
| 217 | + " transit=transit,\n", |
| 218 | + " buildings=buildings,\n", |
| 219 | + " water_name=water_name,\n", |
| 220 | + " transportation_name=transportation_name,\n", |
| 221 | + " places=place,\n", |
| 222 | + " housenumber=housenumber,\n", |
| 223 | + " pois=poi,\n", |
| 224 | + " earth=earth,\n", |
| 225 | + ")" |
104 | 226 | ]
|
105 | 227 | },
|
106 | 228 | {
|
|
116 | 238 | "metadata": {},
|
117 | 239 | "outputs": [],
|
118 | 240 | "source": [
|
119 |
| - "m.add_vector_tile_layer(url, attribution, vector_tile_layer_styles)\n", |
| 241 | + "m.add_vector_tile_layer(url, vector_tile_layer_styles, attribution=attribution)\n", |
120 | 242 | "m"
|
121 | 243 | ]
|
122 | 244 | }
|
|
0 commit comments