{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0.5.0+27.g2d457b0.dirty\n" ] } ], "source": [ "import os\n", "import folium\n", "\n", "print(folium.__version__)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m = folium.Map(location=[41, -70], zoom_start=5, tiles=None)\n", "\n", "\n", "folium.raster_layers.TileLayer(\n", " tiles='http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',\n", " attr='google',\n", " name='google maps',\n", " max_zoom=20,\n", " subdomains=['mt0', 'mt1', 'mt2', 'mt3'],\n", " overlay=False,\n", " control=True,\n", ").add_to(m)\n", "\n", "folium.raster_layers.TileLayer(\n", " tiles='http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}',\n", " attr='google',\n", " name='google street view',\n", " max_zoom=20,\n", " subdomains=['mt0', 'mt1', 'mt2', 'mt3'],\n", " overlay=False,\n", " control=True,\n", ").add_to(m)\n", "\n", "\n", "folium.raster_layers.WmsTileLayer(\n", " url='https://demo.boundlessgeo.com/geoserver/ows?',\n", " layers='nasa:bluemarble',\n", " name='bluemarble',\n", " fmt='image/png',\n", " overlay=False,\n", " control=True,\n", ").add_to(m)\n", "\n", "\n", "folium.raster_layers.WmsTileLayer(\n", " url='http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi',\n", " name='test',\n", " fmt='image/png',\n", " layers='nexrad-n0r-900913',\n", " attr=u'Weather data © 2012 IEM Nexrad',\n", " transparent=True,\n", " overlay=True,\n", " control=True,\n", ").add_to(m)\n", "\n", "folium.LayerControl().add_to(m)\n", "\n", "m.save(os.path.join('results', 'WMS_and_WMTS.html'))\n", "\n", "m" ] } ], "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.6.2" } }, "nbformat": 4, "nbformat_minor": 1 }