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