示例#1
0
def build_alerts_map():
    """
    The following function mobilises functions defined hereabove or in the utils module to
    instantiate and return a dl.Map object, corresponding to the "Alerts and Infrastructure" view.
    """
    map_object = dl.Map(
        center=[44.73,
                4.27],  # Determines the point around which the map is centered
        zoom=9,  # Determines the initial level of zoom around the center point
        children=[
            dl.TileLayer(id='tile_layer'),
            build_departments_geojson(),
            build_filters_object(map_type='alerts'),
            build_legend_box(map_type='alerts'),
            dl.MarkerClusterGroup(
                children=build_sites_markers(sites_with_live_alerts=[]),
                id='sites_markers'),
            dl.LayerGroup(id='vision_polygons'),
            html.Div(id="live_alerts_marker"),
            html.Div(id="live_alert_header_btn"),
            html.Div(id='fire_markers_alerts')
        ],  # Will contain the past fire markers of the alerts map
        style=map_style,  # Reminder: map_style is imported from utils.py
        id='map')

    return map_object
示例#2
0
def dpt_color_opacity(opacity_level):
    '''
    This callback takes as input the opacity level chosen by the user on the slider
    and reinstantiates the colorbar and geojson objects accordingly.
    These new objects are then injected in the map's children attribute.
    '''
    colorbar, geojson = build_risks_geojson_and_colorbar(
        opacity_level=opacity_level)

    return [
        dl.TileLayer(id='tile_layer'),
        geojson,
        colorbar,
        build_info_object(app_page='risks'),
        build_legend_box(app_page='risks'),
        html.Div(id='fire_markers_risks'
                 )  # Will contain the past fire markers of the risks map
    ]
示例#3
0
def build_alerts_map():

    map_object = dl.Map(
        center=[
            46.5, 2
        ],  # Determines the point around which the map is initially centered
        zoom=6,  # Determines the initial level of zoom around the center point
        children=[
            dl.TileLayer(id='tile_layer'),
            build_departments_geojson(),
            build_info_object(app_page='alerts'),
            build_legend_box(app_page='alerts'),
            build_sites_markers(),
            html.Div(id="live_alerts_marker"),
            html.Div(id='fire_markers_alerts')
        ],  # Will contain the past fire markers of the alerts map
        style=map_style,  # Reminder: map_style is imported from utils.py
        id='map')

    return map_object
示例#4
0
def change_color_opacity(opacity_level):
    """
    -- Managing color opacity in the choropleth map --

    This callback takes as input the opacity level chosen by the user on the slider.
    It then reinstantiates the colorbar and geojson objects accordingly.
    These new objects are finally returned into the risks map's children attribute.
    """
    colorbar, geojson = build_risks_geojson_and_colorbar(
        opacity_level=opacity_level)

    return [
        dl.TileLayer(id='tile_layer'),
        geojson,
        colorbar,
        build_info_object(map_type='risks'),
        build_legend_box(map_type='risks'),
        html.Div(id='fire_markers_risks'
                 ),  # Will contain the past fire markers of the risks map
        html.Div(id='live_alerts_marker')
    ]
示例#5
0
def build_risks_map():
    """
    This function mobilises functions defined hereabove or in the utils module to
    instantiate and return a dl.Map object, corresponding to the "Risk Score" view.
    """

    geojson, colorbar = build_risks_geojson_and_colorbar()

    map_object = dl.Map(center=[46.5, 2],          # Determines the point around which the map is initially centered
                        zoom=6,                    # Determines the initial level of zoom around the center point
                        children=[dl.TileLayer(id='tile_layer'),
                                  geojson,
                                  colorbar,
                                  build_filters_object(map_type='risks'),
                                  build_legend_box(map_type='risks'),
                                  html.Div(id='fire_markers_risks'),  # Will contain past fire markers of the risks map
                                  html.Div(id='live_alerts_marker')
                                  ],
                        style=map_style,           # Reminder: map_style is imported from utils.py
                        id='map')

    return map_object
示例#6
0
def build_risks_map():

    geojson, colorbar = build_risks_geojson_and_colorbar()

    map_object = dl.Map(
        center=[
            46.5, 2
        ],  # Determines the point around which the map is initially centered
        zoom=6,  # Determines the initial level of zoom around the center point
        children=[
            dl.TileLayer(id='tile_layer'),
            geojson,
            colorbar,
            build_info_object(app_page='risks'),
            build_legend_box(app_page='risks'),
            html.Div(id='fire_markers_risks'
                     )  # Will contain past fire markers of the risks map
        ],
        style=map_style,  # Reminder: map_style is imported from utils.py
        id='map')

    return map_object