In [2]:
from folium.folium import Map
from IPython.display import HTML
def inline_map(m):
if isinstance(m, Map):
m._build_map()
srcdoc = m.HTML.replace('"', '"')
embed = HTML('<iframe srcdoc="{srcdoc}" '
'style="width: 100%; height: 500px; '
'border: none"></iframe>'.format(srcdoc=srcdoc))
else:
raise ValueError('{!r} is not a folium Map instance.')
return embed
Now just click hover the mouse on the top right icon, select a layer and have fun ;-)
In [3]:
width, height = 650, 450
m = Map(width=width, height=height, location=[-10, -20], zoom_start=4)
add = '/MapServer/tile/{z}/{y}/{x}'
ESRI = dict(World_Ocean_Base='http://services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base',
World_Navigation_Charts='http://services.arcgisonline.com/ArcGIS/rest/services/Specialty/World_Navigation_Charts',
World_Ocean_Reference='http://services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference',
NatGeo_World_Map='http://services.arcgisonline.com/arcgis/rest/services/NatGeo_World_Map/MapServer',
World_Imagery='http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer',
World_Physical_Map='http://services.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer',
World_Shaded_Relief='http://services.arcgisonline.com/arcgis/rest/services/World_Shaded_Relief/MapServer',
World_Street_Map='http://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer',
World_Terrain_Base='http://services.arcgisonline.com/arcgis/rest/services/World_Terrain_Base/MapServer',
World_Topo_Map='http://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer')
for tile_name, tile_url in ESRI.items():
tile_url += add
m.add_tile_layer(tile_name=tile_name,
tile_url=tile_url)
m.add_layers_to_map()
inline_map(m)
Out[3]:
In [4]:
m = Map(width=width, height=height, location=[28, -81], zoom_start=6)
m.add_wms_layer(wms_name="SST",
wms_url="http://nowcoast.noaa.gov/wms/com.esri.wms.Esrimap/analyses",
wms_format="image/png",
wms_layers='NCEP_RAS_ANAL_RTG_SST')
m.add_wms_layer(wms_name="coastal_labels",
wms_url="http://nowcoast.noaa.gov/wms/com.esri.wms.Esrimap/analyses",
wms_format="image/png",
wms_layers='coastal_labels')
m.add_wms_layer(wms_name="RTMA_PT_WINDVECT_10",
wms_url="http://nowcoast.noaa.gov/wms/com.esri.wms.Esrimap/analyses",
wms_format="image/png",
wms_layers='RTMA_PT_WINDVECT_10')
m.add_wms_layer(wms_name="GMRT",
wms_url="http://gmrt.marine-geo.org/cgi-bin/mapserv?map=/public/mgg/web/gmrt.marine-geo.org/htdocs/services/map/wms_merc.map",
wms_format="image/png",
wms_layers='topo')
m.add_layers_to_map()
inline_map(m)
Out[4]:
In [5]:
HTML(html)
Out[5]: