# The extractor gets the data toilet_extr = ToiletExtractor( './data/oeffentlichetoilettenmuenchen2016-06-28.csv', 'latitude', 'longitude') # The renderer deals with visual aspects of the map renderer = DefaultRenderer(center=marienplatz, zoom=12, opacity=0.35, color_scale=custom_color_scale, tiles='cartodbdark_matter') # Create a new heatmap h_map = HeatMap(None, geo_json, filename='toilet', square_size=500, num_threads=100, load_intermediate_results=True) h_map.generate(toilet_extr.get_value) h_map.normalize() # Generate the polygon areas within 1km of a public toilet h_map.generate_polygon(lambda v: v.get('lin_value', 999) < 1.0, dash_array=[5, 5], color='#0ef', opacity=0.5, weight=2) # Render and save h_map.render(renderer, before_saving=toilet_extr.add_markers)
return contents def bikable_zone(unit): if 'original_value' not in unit or unit.get('original_value') is None: return False return unit.get('original_value') > 1.5 and unit.get('bike_val') < 25 renderer = DefaultRenderer(center=home, zoom=12, opacity=0.5, label=make_label, color_scale=custom_color_scale) h_map = HeatMap(home, geo_json, filename='bike_vs_ubahn', square_size=800, num_threads=100, load_intermediate_results=True) h_map.generate(calc_time) h_map.normalize(normalize_log2_scale) h_map.generate_polygon(bikable_zone, color='#0012b3', opacity=0.6, weight=5, dash_array=[1, 6]) h_map.render( renderer, before_saving=lambda r, _: r.add_circle(home, color='#0012b3', radius=20))