<s> import os <EOL> from osgeo import ogr <EOL> import folium <EOL> import listing4_3 <EOL> colors = { <EOL> '<STR_LIT:action>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> def get_popup ( attributes ) : <EOL> """<STR_LIT>""" <EOL> template = '''<STR_LIT>''' <EOL> return template . format ( ** attributes ) <EOL> def add_markers ( fmap , json_fn ) : <EOL> ds = ogr . Open ( json_fn ) <EOL> lyr = ds . GetLayer ( ) <EOL> for row in lyr : <EOL> geom = row . geometry ( ) <EOL> color = colors [ row . GetField ( '<STR_LIT:status>' ) ] <EOL> fmap . circle_marker ( [ geom . GetY ( ) , geom . GetX ( ) ] , <EOL> line_color = color , <EOL> fill_color = color , <EOL> radius = <NUM_LIT> , <EOL> popup = get_popup ( row . items ( ) ) ) <EOL> def make_map ( state_name , json_fn , html_fn , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> geom = listing4_3 . get_state_geom ( state_name ) <EOL> listing4_3 . save_state_gauges ( json_fn , listing4_3 . get_bbox ( geom ) ) <EOL> fmap = folium . Map ( location = listing4_3 . get_center ( geom ) , ** kwargs ) <EOL> add_markers ( fmap , json_fn ) <EOL> fmap . create_map ( path = html_fn ) <EOL> os . chdir ( r'<STR_LIT>' ) <EOL> make_map ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> zoom_start = <NUM_LIT:7> , tiles = '<STR_LIT>' ) </s>
