@@ -828,7 +828,12 @@ def get_operators(analysis_date, operator_list, verbose=False):
828
828
829
829
830
830
def spa_map_export_link (
831
- gdf : gpd .GeoDataFrame , path : str , state : dict , site : str = SPA_MAP_SITE , cache_seconds : int = 3600
831
+ gdf : gpd .GeoDataFrame ,
832
+ path : str ,
833
+ state : dict ,
834
+ site : str = SPA_MAP_SITE ,
835
+ cache_seconds : int = 3600 ,
836
+ verbose : bool = False ,
832
837
):
833
838
"""
834
839
Called via set_state_export. Handles stream writing of gzipped geojson to GCS bucket,
@@ -837,7 +842,8 @@ def spa_map_export_link(
837
842
assert cache_seconds in range (3601 ), "cache must be 0-3600 seconds"
838
843
geojson_str = gdf .to_json ()
839
844
geojson_bytes = geojson_str .encode ("utf-8" )
840
- print (f"writing to { path } " )
845
+ if verbose :
846
+ print (f"writing to { path } " )
841
847
with fs .open (path , "wb" ) as writer : # write out to public-facing GCS?
842
848
with gzip .GzipFile (fileobj = writer , mode = "w" ) as gz :
843
849
gz .write (geojson_bytes )
@@ -853,7 +859,14 @@ def set_state_export(
853
859
bucket : str = SPA_MAP_BUCKET ,
854
860
subfolder : str = "testing/" ,
855
861
filename : str = "test2" ,
856
- map_type : Literal ["speedmap" , "speed_variation" , "hqta_areas" , "hqta_stops" , "state_highway_network" ] = None ,
862
+ map_type : Literal [
863
+ "speedmap" ,
864
+ "speed_variation" ,
865
+ "new_speedmap" ,
866
+ "new_speed_variation" "hqta_areas" ,
867
+ "hqta_stops" ,
868
+ "state_highway_network" ,
869
+ ] = None ,
857
870
map_title : str = "Map" ,
858
871
cmap : branca .colormap .ColorMap = None ,
859
872
color_col : str = None ,
@@ -890,7 +903,7 @@ def set_state_export(
890
903
]
891
904
if map_type :
892
905
this_layer [0 ]["type" ] = map_type
893
- if map_type == " speedmap" :
906
+ if map_type in [ "new_speedmap" , " speedmap"] :
894
907
this_layer [0 ]["properties" ]["tooltip_speed_key" ] = "p20_mph"
895
908
spa_map_state ["layers" ] += this_layer
896
909
if manual_centroid :
0 commit comments