コード例 #1
0
def collisions_choropleth_map():

    pageopts = {
        'uppercase': 'Traffic Collisions',
        'lowercase': 'traffic collisions',
        'maptype': 'Choropleth Map',
    }

    mapdata = {}

    if request.method == 'POST':
        userfilters = models.get_userfilters(request.form)
        filters = userfilters
        region_type = request.form['region_type']
        mapdata['geojson'], mapdata['colorbar'] = models.choropleth_geojson(
            app.df_collisions, region_type, filters)
    else:
        filters = models.get_defaultfilters()
        region_type = 'nhood'
        mapdata['filename'] = 'collisions-choropleth-default.json'
        mapdata[
            'colorbar_filename'] = 'collisions-choropleth-default-colorbar.json'

    return render_template('map.html',
                           pageopts=pageopts,
                           maptype='choropleth',
                           regionopts=models.get_regionopts()[region_type],
                           mapdata=mapdata,
                           filtersdisplay=models.build_filtersdisplay(filters))
コード例 #2
0
ファイル: controllers.py プロジェクト: jayqi/sf-walk-safety
def collisions_choropleth_map():

    pageopts = {
        'uppercase' : 'Traffic Collisions',
        'lowercase' : 'traffic collisions',
        'maptype' : 'Choropleth Map',
    }

    mapdata = {}

    if request.method == 'POST':
        userfilters = models.get_userfilters(request.form)
        filters = userfilters
        region_type = request.form['region_type']
        mapdata['geojson'],mapdata['colorbar'] = models.choropleth_geojson(app.df_collisions,region_type,filters)
    else:
        filters = models.get_defaultfilters()
        region_type = 'nhood'
        mapdata['filename'] = 'collisions-choropleth-default.json'
        mapdata['colorbar_filename'] = 'collisions-choropleth-default-colorbar.json'

    return render_template('map.html',
        pageopts=pageopts,
        maptype='choropleth',
        regionopts=models.get_regionopts()[region_type],
        mapdata=mapdata,
        filtersdisplay=models.build_filtersdisplay(filters)
        )
コード例 #3
0
def thefts_heat_map():

    if request.method == 'POST':
        userfilters = models.get_userfilters(request.form)
        filters = userfilters
    else:
        filters = models.get_defaultfilters()

    pageopts = {
        'uppercase': 'Thefts',
        'lowercase': 'thefts',
        'maptype': 'Heat Map',
    }

    return render_template('map.html',
                           pageopts=pageopts,
                           maptype='heat',
                           mapdata=models.heat_listcoords(
                               app.df_thefts, filters),
                           filtersdisplay=models.build_filtersdisplay(filters))
コード例 #4
0
ファイル: controllers.py プロジェクト: jayqi/sf-walk-safety
def thefts_heat_map():

    if request.method == 'POST':
        userfilters = models.get_userfilters(request.form)
        filters = userfilters
    else:
        filters = models.get_defaultfilters()

    pageopts = {
        'uppercase' : 'Thefts',
        'lowercase' : 'thefts',
        'maptype' : 'Heat Map',
    }

    return render_template('map.html',
        pageopts=pageopts,
        maptype='heat',
        mapdata=models.heat_listcoords(app.df_thefts,filters),
        filtersdisplay=models.build_filtersdisplay(filters)
        )
コード例 #5
0
def theft_markers_map():

    pageopts = {
        'uppercase': 'Thefts',
        'lowercase': 'thefts',
        'maptype': 'Individual Incidents Map',
    }

    mapdata = {}

    if request.method == 'POST':
        userfilters = models.get_userfilters(request.form)
        filters = userfilters
        mapdata['geojson'] = models.markers_geojson(app.df_thefts, filters)
    else:
        filters = models.get_defaultfilters()
        mapdata['filename'] = 'thefts-markers-default.json'

    return render_template('map.html',
                           pageopts=pageopts,
                           maptype='markers',
                           mapdata=mapdata,
                           filtersdisplay=models.build_filtersdisplay(filters))
コード例 #6
0
ファイル: controllers.py プロジェクト: jayqi/sf-walk-safety
def theft_markers_map():

    pageopts = {
        'uppercase' : 'Thefts',
        'lowercase' : 'thefts',
        'maptype' : 'Individual Incidents Map',
    }

    mapdata = {}

    if request.method == 'POST':
        userfilters = models.get_userfilters(request.form)
        filters = userfilters
        mapdata['geojson'] = models.markers_geojson(app.df_thefts,filters)
    else:
        filters = models.get_defaultfilters()
        mapdata['filename'] = 'thefts-markers-default.json'

    return render_template('map.html',
        pageopts=pageopts,
        maptype='markers',
        mapdata=mapdata,
        filtersdisplay=models.build_filtersdisplay(filters)
        )