|
16 | 16 | "metadata": {},
|
17 | 17 | "outputs": [],
|
18 | 18 | "source": [
|
19 |
| - "import contextily as ctx\n", |
| 19 | + "import contextily as cx\n", |
20 | 20 | "import xyzservices.providers as xyz\n",
|
21 | 21 | "\n",
|
22 | 22 | "import matplotlib.pyplot as plt"
|
|
60 | 60 | "source": [
|
61 | 61 | "fig, ax = plt.subplots(figsize=(8, 8))\n",
|
62 | 62 | "ax.axis(extent)\n",
|
63 |
| - "ctx.add_basemap(ax)" |
| 63 | + "cx.add_basemap(ax)" |
64 | 64 | ]
|
65 | 65 | },
|
66 | 66 | {
|
|
91 | 91 | "source": [
|
92 | 92 | "fig, ax = plt.subplots(figsize=(8, 8))\n",
|
93 | 93 | "ax.axis(extent)\n",
|
94 |
| - "ctx.add_basemap(ax, source=ctx.providers.CartoDB.Positron)" |
| 94 | + "cx.add_basemap(ax, source=cx.providers.CartoDB.Positron)" |
95 | 95 | ]
|
96 | 96 | },
|
97 | 97 | {
|
|
120 | 120 | "source": [
|
121 | 121 | "fig, ax = plt.subplots(figsize=(8, 8))\n",
|
122 | 122 | "ax.axis(extent)\n",
|
123 |
| - "ctx.add_basemap(ax, source=ctx.providers.OpenStreetMap.Mapnik)" |
| 123 | + "cx.add_basemap(ax, source=cx.providers.OpenStreetMap.Mapnik)" |
124 | 124 | ]
|
125 | 125 | },
|
126 | 126 | {
|
127 | 127 | "cell_type": "markdown",
|
128 | 128 | "metadata": {},
|
129 | 129 | "source": [
|
130 |
| - "Passing `source=ctx.providers.OpenStreetMap.Mapnik` is exactly the same as using `xyzservices` directly - `source=xyz.OpenStreetMap.Mapnik`. Under the hood, `contextily.providers` just wraps `xyzservices.providers`." |
| 130 | + "Passing `source=cx.providers.OpenStreetMap.Mapnik` is exactly the same as using `xyzservices` directly - `source=xyz.OpenStreetMap.Mapnik`. Under the hood, `contextily.providers` just wraps `xyzservices.providers`." |
131 | 131 | ]
|
132 | 132 | },
|
133 | 133 | {
|
|
149 | 149 | "source": [
|
150 | 150 | "fig, ax = plt.subplots(figsize=(8, 8))\n",
|
151 | 151 | "ax.axis(extent)\n",
|
152 |
| - "ctx.add_basemap(ax, source=xyz.OpenStreetMap.Mapnik)" |
| 152 | + "cx.add_basemap(ax, source=xyz.OpenStreetMap.Mapnik)" |
153 | 153 | ]
|
154 | 154 | },
|
155 | 155 | {
|
|
18639 | 18639 | }
|
18640 | 18640 | ],
|
18641 | 18641 | "source": [
|
18642 |
| - "ctx.providers" |
| 18642 | + "cx.providers" |
18643 | 18643 | ]
|
18644 | 18644 | },
|
18645 | 18645 | {
|
|
18997 | 18997 | }
|
18998 | 18998 | ],
|
18999 | 18999 | "source": [
|
19000 |
| - "ctx.providers.OpenStreetMap" |
| 19000 | + "cx.providers.OpenStreetMap" |
19001 | 19001 | ]
|
19002 | 19002 | },
|
19003 | 19003 | {
|
|
19024 | 19024 | }
|
19025 | 19025 | ],
|
19026 | 19026 | "source": [
|
19027 |
| - "type(ctx.providers.OpenStreetMap.Mapnik)" |
| 19027 | + "type(cx.providers.OpenStreetMap.Mapnik)" |
19028 | 19028 | ]
|
19029 | 19029 | },
|
19030 | 19030 | {
|
|
19189 | 19189 | }
|
19190 | 19190 | ],
|
19191 | 19191 | "source": [
|
19192 |
| - "ctx.providers.OpenStreetMap.Mapnik" |
| 19192 | + "cx.providers.OpenStreetMap.Mapnik" |
19193 | 19193 | ]
|
19194 | 19194 | },
|
19195 | 19195 | {
|
|
19373 | 19373 | }
|
19374 | 19374 | ],
|
19375 | 19375 | "source": [
|
19376 |
| - "ctx.providers.OpenWeatherMap.Clouds" |
| 19376 | + "cx.providers.OpenWeatherMap.Clouds" |
19377 | 19377 | ]
|
19378 | 19378 | },
|
19379 | 19379 | {
|
|
19541 | 19541 | }
|
19542 | 19542 | ],
|
19543 | 19543 | "source": [
|
19544 |
| - "ctx.providers.OpenWeatherMap.Clouds(apiKey=\"my-private-api-key\")" |
| 19544 | + "cx.providers.OpenWeatherMap.Clouds(apiKey=\"my-private-api-key\")" |
19545 | 19545 | ]
|
19546 | 19546 | },
|
19547 | 19547 | {
|
|
19551 | 19551 | "This can then be specified where a `source` is expected. For example:\n",
|
19552 | 19552 | " \n",
|
19553 | 19553 | "```python\n",
|
19554 |
| - "ctx.add_basemap(ax, source=ctx.providers.OpenWeatherMap.Clouds(apiKey=\"my-private-api-key\"))\n", |
| 19554 | + "cx.add_basemap(ax, source=cx.providers.OpenWeatherMap.Clouds(apiKey=\"my-private-api-key\"))\n", |
19555 | 19555 | "```\n"
|
19556 | 19556 | ]
|
19557 | 19557 | },
|
|
19588 | 19588 | "source": [
|
19589 | 19589 | "fig, ax = plt.subplots(figsize=(8, 8))\n",
|
19590 | 19590 | "ax.axis(extent)\n",
|
19591 |
| - "# using the url from `ctx.providers.OpenStreetMap.HOT` as example\n", |
19592 |
| - "ctx.add_basemap(ax, source='https://a.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png')" |
| 19591 | + "# using the url from `cx.providers.OpenStreetMap.HOT` as example\n", |
| 19592 | + "cx.add_basemap(ax, source='https://a.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png')" |
19593 | 19593 | ]
|
19594 | 19594 | },
|
19595 | 19595 | {
|
|
19619 | 19619 | "metadata": {},
|
19620 | 19620 | "outputs": [],
|
19621 | 19621 | "source": [
|
19622 |
| - "providers = ctx.providers.flatten()" |
| 19622 | + "providers = cx.providers.flatten()" |
19623 | 19623 | ]
|
19624 | 19624 | },
|
19625 | 19625 | {
|
|
19696 | 19696 | "axs = axs.flatten()\n",
|
19697 | 19697 | "for name, ax in zip(selection, axs):\n",
|
19698 | 19698 | " ax.axis(extent)\n",
|
19699 |
| - " ctx.add_basemap(ax, source=providers[name])\n", |
| 19699 | + " cx.add_basemap(ax, source=providers[name])\n", |
19700 | 19700 | " ax.set_title(name)\n",
|
19701 | 19701 | " ax.set_axis_off()\n",
|
19702 | 19702 | "plt.show()\n",
|
|
0 commit comments