Skip to content
Snippets Groups Projects
Commit c6e6b494 authored by yager2's avatar yager2
Browse files

Replace Visualizations.py to include map_links() function

parent b9117d57
No related branches found
No related tags found
No related merge requests found
......@@ -129,4 +129,23 @@ def map_links_with_many_signatures(threshold=7): # threshold for number of signa
geo_df.to_file('High_Signature_Map')
return None
\ No newline at end of file
def map_links(link_list=None, link_file=None, out_file='Map'):
assert link_list is None or link_file is None, 'Choose exactly one list or file to convert to map!'
if link_list is not None:
link_id_list = link_list
else:
link_id_list=np.loadtxt(link_file)
filenames = config.generate_filenames('')
link_df = gpd.pd.read_csv(filenames['links'])
crs = {'init': 'epsg:4326'}
df = link_df[link_df['link_id'].isin(link_id_list)]
df['geom'] = df.apply(lambda x: LineString([(x.startX,x.startY),(x.endX,x.endY)]), axis=1)
geo_df = gpd.GeoDataFrame(df, crs=crs, geometry='geom')
geo_df.to_file(out_file)
return None
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment