Esempio n. 1
0
from pyComparisonlib import compute_hausdorff
print("Imported modules")



#%% Data Extraction
sublist = [121143, 121144, 147793, 148717, 148718, 148719, 148720, 148721, 148723,
       150353, 150589, 150638, 150692, 150722, 150723, 150724, 150725, 150726, 
       150727, 150728]
synth_net = GetDistNet(synpath,sublist)
print("Synthetic network extracted")

#areas = {'patrick_henry':194,'mcbryde':9001,'hethwood':7001}
areas = {'patrick_henry':194,'mcbryde':9001}

area_data = {area:get_areadata(actpath,area,root,synth_net) \
                      for area,root in areas.items()}
print("Area Data extracted and stored")

c_actual = 'orangered'
c_synth = 'blue'

#%% Functions for comparing actual and synthetic networks
# Exract area data
def get_limits(area_data):
    # Get limits for the geographical region
    lims = np.empty(shape=(len(area_data),4))
    for i,area in enumerate(area_data):
        lims[i,:] = np.array(area_data[area]['limits'])
    LEFT = np.min(lims[:,0]); RIGHT = np.max(lims[:,1])
    BOTTOM = np.min(lims[:,2]); TOP = np.max(lims[:,3])
sys.path.append(libpath)
from pyDrawNetworklib import plot_gdf
from pyExtractDatalib import GetOSMRoads, get_areadata, GetDistNet
print("Imported modules")

sublist = [
    121143, 121144, 147793, 148717, 148718, 148719, 148720, 148721, 148723,
    150353, 150589, 150638, 150692, 150722, 150723, 150724, 150725, 150726,
    150727, 150728
]
synth_net = GetDistNet(distpath, sublist)
roads = GetOSMRoads(inppath, '121')

areas = {'patrick_henry': 194, 'mcbryde': 9001, 'hethwood': 7001}
# areas = {'patrick_henry':194,'mcbryde':9001}
area_data = {area:get_areadata(qgispath,area,root,synth_net) \
                      for area,root in areas.items()}

#%% Plot comparison
DPI = 72
fig = plt.figure(figsize=(10, 15), dpi=DPI)
ax = plt.subplot()
for area in area_data:
    plot_gdf(ax, area_data[area]['df_lines'], area_data[area]['df_buses'],
             'orangered')
    plot_gdf(ax, area_data[area]['df_synth'], area_data[area]['df_cords'],
             'blue')
ax.tick_params(bottom=False, left=False, labelleft=False, labelbottom=False)

ymin, ymax = ax.get_ylim()
xmin, xmax = ax.get_xlim()