OSGeoLive-Notebooks/Cartopy/cartopy-image-tiles.ipynb

74 lines
1.4 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import cartopy.crs as ccrs\n",
"\n",
"from cartopy.io.img_tiles import Stamen\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def main():\n",
" tiler = Stamen('terrain-background')\n",
" mercator = tiler.crs\n",
"\n",
" fig = plt.figure()\n",
" ax = fig.add_subplot(1, 1, 1, projection=mercator)\n",
" ax.set_extent([-90, -73, 22, 34], crs=ccrs.PlateCarree())\n",
"\n",
" ax.add_image(tiler, 6)\n",
"\n",
" ax.coastlines('10m')\n",
" plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"main()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"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.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}