def make_map(bbox, **kw):
    line = kw.pop("line", True)
    layers = kw.pop("layers", True)
    zoom_start = kw.pop("zoom_start", 5)

    lon = (bbox[0] + bbox[2]) / 2
    lat = (bbox[1] + bbox[3]) / 2
    m = folium.Map(
        width="100%", height="100%", location=[lat, lon], zoom_start=zoom_start
    )

    if layers:
        url = "http://oos.soest.hawaii.edu/thredds/wms/hioos/satellite/dhw_5km"
        w = folium.WmsTileLayer(
            url,
            name="Sea Surface Temperature",
            fmt="image/png",
            layers="CRW_SST",
            attr="PacIOOS TDS",
            overlay=True,
            transparent=True,
        )
        w.add_to(m)

    if line:
        p = folium.PolyLine(
            get_coordinates(bbox), color="#FF0000", weight=2, opacity=0.9,
        )
        p.add_to(m)
    return m
def make_map(bbox, **kw):
    line = kw.pop("line", True)
    layers = kw.pop("layers", True)
    zoom_start = kw.pop("zoom_start", 5)

    lon = (bbox[0] + bbox[2]) / 2
    lat = (bbox[1] + bbox[3]) / 2
    m = folium.Map(
        width="100%", height="100%", location=[lat, lon], zoom_start=zoom_start
    )

    if layers:
        url = "http://geoport-dev.whoi.edu/thredds/wms/coawst_4/use/fmrc/coawst_4_use_best.ncd"
        w = folium.WmsTileLayer(
            url,
            name="COAWST Wave Height",
            fmt="image/png",
            layers="Hwave",
            style="boxfill/rainbow",
            COLORSCALERANGE="0,5",
            overlay=True,
            transparent=True,
        )
        w.add_to(m)

    if line:
        p = folium.PolyLine(
            get_coordinates(bbox), color="#FF0000", weight=2, opacity=0.9
        )
        p.add_to(m)
    return m
Exemplo n.º 3
0
####################
if wind_stations:
    # Wind Observations stations.
    #marker_clusterw = MarkerCluster(name='Wind observations')
    #marker_clusterw.add_to(m)
    for ssh1, model1 in zip(wnd_observs,wnd_models):
        fname = ssh1._metadata['station_code']
        location = ssh1._metadata['lat'] , ssh1._metadata['lon'] 
        p = make_plot(ssh1, model1,'Wind [m/s]')
        #p = make_plot(ssh1, ssh1)    
        marker = make_marker(p, location=location, fname=fname, color = 'red')
        marker.add_to(marker_cluster_coops)

###################        
# folium.LayerControl().add_to(m)
p = folium.PolyLine(get_coordinates(bbox),
                    color='#009933',
                    weight=1,
                    opacity=0.5)

p.add_to(m)
#################################### 
# 

###################
print('     > Plot NHC cone predictions')

if plot_cones:
    marker_cluster1 = MarkerCluster(name='Past predictions')
    marker_cluster1.add_to(m)
    def style_function(feature):
from ioos_tools.ioos import get_coordinates


def make_map(bbox, **kw):
    line = kw.pop("line", True)
    zoom_start = kw.pop("zoom_start", 5)

    lon = (bbox[0] + bbox[2]) / 2
    lat = (bbox[1] + bbox[3]) / 2
    m = folium.Map(
        width="100%", height="100%", location=[lat, lon], zoom_start=zoom_start
    )

    if line:
        p = folium.PolyLine(
            get_coordinates(bbox), color="#FF0000", weight=2, opacity=0.9,
        )
        p.add_to(m)
    return m

bbox = config["region"]["bbox"]

m = make_map(bbox, zoom_start=8, line=True, layers=True)

all_obs = stations_keys(config)

from glob import glob
from operator import itemgetter

import iris
from folium.plugins import MarkerCluster
Exemplo n.º 5
0
    folium.CircleMarker(
        location=location, radius=5, fill=True, color=colors[hclass], popup=popup,
    ).add_to(m)


# Observations.
for ssh, wind in zip(ssh_observations, winds_observations):
    fname = ssh._metadata["station_code"]
    location = ssh._metadata["lat"], ssh._metadata["lon"]
    p = make_plot(ssh, wind)
    marker = make_marker(p, location=location, fname=fname)
    marker.add_to(marker_cluster0)

folium.LayerControl().add_to(m)

p = folium.PolyLine(get_coordinates(bbox), color="#009933", weight=1, opacity=0.2)

p.add_to(m)

def embed_map(m):
    from IPython.display import HTML

    m.save("index.html")
    with open("index.html") as f:
        html = f.read()

    iframe = '<iframe srcdoc="{srcdoc}" style="width: 100%; height: 750px; border: none"></iframe>'
    srcdoc = html.replace('"', "&quot;")
    return HTML(iframe.format(srcdoc=srcdoc))

Exemplo n.º 6
0
def make_map(bbox, **kw):
    """
    Creates a folium map instance.

    Examples
    --------
    >>> from folium import Map
    >>> bbox = [-87.40, 24.25, -74.70, 36.70]
    >>> m = make_map(bbox)
    >>> isinstance(m, Map)
    True

    """
    import folium

    line = kw.pop('line', True)
    layers = kw.pop('layers', True)
    zoom_start = kw.pop('zoom_start', 5)

    lon, lat = np.array(bbox).reshape(2, 2).mean(axis=0)
    #
    m = folium.Map(width='100%',
                   height='100%',
                   location=[lat, lon],
                   zoom_start=zoom_start)

    if layers:
        add = 'MapServer/tile/{z}/{y}/{x}'
        base = 'http://services.arcgisonline.com/arcgis/rest/services'
        ESRI = dict(
            Imagery='World_Imagery/MapServer',
            #Ocean_Base='Ocean/World_Ocean_Base',
            #Topo_Map='World_Topo_Map/MapServer',
            #Physical_Map='World_Physical_Map/MapServer',
            #Terrain_Base='World_Terrain_Base/MapServer',
            #NatGeo_World_Map='NatGeo_World_Map/MapServer',
            #Shaded_Relief='World_Shaded_Relief/MapServer',
            #Ocean_Reference='Ocean/World_Ocean_Reference',
            #Navigation_Charts='Specialty/World_Navigation_Charts',
            #Street_Map='World_Street_Map/MapServer'
        )

        for name, url in ESRI.items():
            url = '{}/{}/{}'.format(base, url, add)

            w = folium.TileLayer(tiles=url,
                                 name=name,
                                 attr='ESRI',
                                 overlay=False)
            w.add_to(m)

    if line:  # Create the map and add the bounding box line.
        p = folium.PolyLine(get_coordinates(bbox),
                            color='#FF0000',
                            weight=2,
                            opacity=0.5,
                            latlon=True)
        p.add_to(m)

    folium.LayerControl().add_to(m)
    return m