#!/usr/bin/env python # coding: utf-8 # # # ### 复旦大学新闻学院新媒体硕士课程 # *** # *** # # 使用folium做地图可视化 # *** # *** # # 王成军 # # wangchengjun@nju.edu.cn # # 计算传播网 http://computational-communication.com # # In[4]: get_ipython().system('pip install folium') # In[6]: get_ipython().system('pip install vincent') # In[7]: import folium, jinja2, vincent from IPython.display import IFrame from IPython.core.display import HTML print(folium.__file__) print(folium.__version__) # # 读入数据 # In[2]: import pickle node_pkl = open('../data/nodeLoc.pkl', 'rb') nodeLoc = pickle.load(node_pkl) node_pkl.close() edge_pkl = open('../data/edgeLoc.pkl', 'rb') edgeLoc = pickle.load(edge_pkl) edge_pkl.close() # # 绘制地图 # In[8]: map_osm = folium.Map(location=[45.5236, -122.6750]) map_osm # In[9]: beijing = folium.Map(location=(39.90403,116.407526), zoom_start=10) # In[10]: beijing # # MarkerCluster # In[13]: from folium.plugins import MarkerCluster locations = nodeLoc popups = ['{}'.format(loc) for loc in locations] beijing.add_child(MarkerCluster(locations=locations, popups=popups)) # # HeatMap # In[14]: from folium import plugins beijing.add_child(plugins.HeatMap(locations)) # In[ ]: beijing.save('beijing_mobile.html') # # PolyLine # In[15]: colors = ['blue','orange', 'red'] for k, community in enumerate(edgeLoc): locations = edgeLoc[community] for loc in locations: line = folium.PolyLine(locations=loc, color=colors[k]) beijing.add_child(line) # In[17]: beijing # In[67]: beijing.save('/Users/chengjun/GitHub/cjc2016/vis/beijing_mobile_without_heat.html') # ### Convert HTML to PNG # * Open the generated html with chrome, # * Print to save it as pdf, # * Open the pdf and export it as png or the other formats. # # Data preparation # python数据持久存储:pickle模块的基本使用 #   python的pickle模块实现了基本的数据序列和反序列化。通过pickle模块的序列化操作我们能够将程序中运行的对象信息保存到文件中去,永久存储;通过pickle模块的反序列化操作,我们能够从文件中创建上一次程序保存的对象。 # In[68]: import pickle # In[69]: output = open('/Users/chengjun/GitHub/cjc2016/data/edgeLoc.pkl', 'wb') # Pickle dictionary using protocol 0. pickle.dump(edgeLoc, output) output.close() # In[70]: output = open('/Users/chengjun/GitHub/cjc2016/data/nodeLoc.pkl', 'wb') # Pickle list using protocol -1 pickle.dump(nodeLoc, output, -1) output.close() # In[36]: edgeLoc = {12196: [[(39.990111, 116.330251), (39.990301, 116.339161)], [(39.990111, 116.330251), (39.991104, 116.343872)], [(39.990111, 116.330251), (40.010696, 116.338602)], [(39.975028, 116.311556), (40.008801, 116.267881)], [(39.884931, 116.672281), (39.886901, 116.675301)], [(39.884931, 116.672281), (39.983333, 116.309944)], [(39.990311, 116.351102), (39.990301, 116.339161)], [(39.990311, 116.351102), (39.991104, 116.343872)], [(39.990311, 116.351102), (39.886901, 116.675301)], [(39.990311, 116.351102), (39.990531, 116.363311)], [(39.990311, 116.351102), (39.989352, 116.356064)], [(39.990311, 116.351102), (40.000241, 116.352881)], [(40.017402, 116.305637), (40.020209, 116.302722)], [(39.920349, 116.327869), (39.979381, 116.308711)], [(39.920349, 116.327869), (39.905001, 116.342225)], [(39.920349, 116.327869), (39.977181, 116.308881)], [(39.988501, 116.318872), (39.984811, 116.315931)], [(39.988501, 116.318872), (39.981691, 116.332721)], [(39.988501, 116.318872), (39.983061, 116.319341)], [(39.988501, 116.318872), (39.978994, 116.329721)], [(39.763371011, 116.322339649), (39.977181, 116.308881)], [(39.994141, 116.405721), (39.977237, 116.308991)], [(40.050083, 116.298417), (40.017394, 116.325471)], [(40.050083, 116.298417), (39.980345, 116.370601)], [(40.050083, 116.298417), (40.010696, 116.338602)], [(39.984811, 116.315931), (39.983061, 116.319341)], [(39.984811, 116.315931), (39.978994, 116.329721)], [(39.978994, 116.329721), (39.990301, 116.339161)], [(39.978994, 116.329721), (39.981691, 116.332721)], [(39.978994, 116.329721), (39.983061, 116.319341)], [(39.978994, 116.329721), (39.989352, 116.356064)], [(39.981691, 116.332721), (39.990301, 116.339161)], [(39.981691, 116.332721), (40.017394, 116.325471)], [(39.983118, 116.310884), (39.983464, 116.308398)], [(39.983464, 116.308398), (39.983471, 116.308391)], [(39.983464, 116.308398), (39.983056, 116.309167)], [(40.017394, 116.325471), (39.990301, 116.339161)], [(40.017394, 116.325471), (40.008171, 116.328254)], [(40.017394, 116.325471), (40.010696, 116.338602)], [(39.977181, 116.308881), (39.977237, 116.308991)], [(39.977181, 116.308881), (39.981928, 116.308731)], [(39.592431, 116.183104), (39.983333, 116.309944)], [(39.983056, 116.309167), (39.983333, 116.309944)], [(40.000241, 116.352881), (39.990301, 116.339161)], [(40.000241, 116.352881), (39.990531, 116.363311)], [(40.000241, 116.352881), (39.991104, 116.343872)], [(40.000241, 116.352881), (40.010696, 116.338602)], [(39.975395, 116.313438), (39.977237, 116.308991)], [(39.979381, 116.308711), (39.905001, 116.342225)], [(39.990301, 116.339161), (39.991104, 116.343872)], [(39.991541, 116.319551), (39.983333, 116.309944)], [(40.008171, 116.328254), (40.010696, 116.338602)], [(39.981928, 116.308731), (39.977147, 116.304633)], [(40.008801, 116.267881), (40.006201, 116.279001)], [(39.978871, 116.306551), (39.977147, 116.304633)], [(39.977237, 116.308991), (39.983333, 116.309944)], [(39.981862, 116.317841), (39.983061, 116.319341)], [(39.990531, 116.363311), (39.989352, 116.356064)]], 12261: [[(40.200491, 116.179253), (40.183415, 116.161574)], [(40.200491, 116.179253), (40.183997, 116.191357)], [(40.200491, 116.179253), (40.218981, 116.230971)], [(40.226655, 116.226144), (40.145755, 116.302861)], [(40.226655, 116.226144), (40.210773, 116.239262)], [(40.226655, 116.226144), (40.222097, 116.220571)], [(40.226655, 116.226144), (40.218981, 116.230971)], [(40.226655, 116.226144), (40.213888, 116.221534)], [(40.226655, 116.226144), (40.213869, 116.234626)], [(40.055072, 116.313491), (40.076948, 116.302963)], [(40.055072, 116.313491), (40.098774, 116.302953)], [(40.171594, 116.244031), (40.210773, 116.239262)], [(40.171594, 116.244031), (40.183997, 116.191357)], [(40.100662, 116.276404), (40.098981, 116.285883)], [(40.100662, 116.276404), (40.096239, 116.272141)], [(40.100662, 116.276404), (40.112621, 116.289151)], [(40.100662, 116.276404), (40.095381, 116.283131)], [(40.100662, 116.276404), (40.106016, 116.276689)], [(40.100662, 116.276404), (40.103275, 116.284444)], [(40.216718, 116.216522), (39.792501, 116.486851)], [(40.216718, 116.216522), (40.213888, 116.221534)], [(40.216718, 116.216522), (40.212898, 116.228058)], [(40.216718, 116.216522), (40.218981, 116.230971)], [(40.029814, 116.317095), (40.034031, 116.319871)], [(40.029814, 116.317095), (40.039607, 116.316384)], [(40.029814, 116.317095), (40.035833, 116.309445)], [(40.056215, 116.327246), (40.058111, 116.330667)], [(40.056215, 116.327246), (40.047312, 116.333848)], [(40.056215, 116.327246), (40.055791, 116.324361)], [(40.056215, 116.327246), (40.057821, 116.340871)], [(40.240347, 116.117703), (40.231194, 116.118111)], [(40.240347, 116.117703), (40.235611, 116.124289)], [(40.240347, 116.117703), (40.220667, 116.239556)], [(40.133908, 116.260049), (40.125971, 116.252163)], [(40.133908, 116.260049), (40.125517, 116.261944)], [(40.133908, 116.260049), (40.131848, 116.266921)], [(40.073638, 116.310218), (40.083291, 116.322045)], [(40.073638, 116.310218), (40.076948, 116.302963)], [(40.073638, 116.310218), (40.077062, 116.325645)], [(40.073638, 116.310218), (40.068287, 116.333102)], [(40.073638, 116.310218), (40.073022, 116.316664)], [(40.073022, 116.316664), (40.083291, 116.322045)], [(40.073022, 116.316664), (40.058111, 116.330667)], [(40.073022, 116.316664), (40.089172, 116.302284)], [(40.073022, 116.316664), (40.065611, 116.322079)], [(40.073022, 116.316664), (40.087491, 116.324951)], [(40.073022, 116.316664), (40.099121, 116.338071)], [(40.073022, 116.316664), (40.077062, 116.325645)], [(40.073022, 116.316664), (40.068287, 116.333102)], [(40.073022, 116.316664), (40.076948, 116.302963)], [(40.231194, 116.118111), (40.235611, 116.124289)], [(40.052918, 116.369476), (40.058111, 116.330667)], [(40.052918, 116.369476), (40.041361, 116.373921)], [(40.140561, 116.262416), (40.141792, 116.258313)], [(40.140561, 116.262416), (40.125517, 116.261944)], [(40.140561, 116.262416), (40.131848, 116.266921)], [(40.134251, 116.252193), (40.125517, 116.261944)], [(40.035833, 116.309445), (40.058111, 116.330667)], [(40.035833, 116.309445), (40.043501, 116.298251)], [(40.035833, 116.309445), (40.034978, 116.306693)], [(40.035833, 116.309445), (40.062711, 116.295361)], [(40.035833, 116.309445), (40.039607, 116.316384)], [(40.035833, 116.309445), (40.034031, 116.319871)], [(40.206013, 116.223627), (40.209889, 116.228222)], [(40.206013, 116.223627), (40.213888, 116.221534)], [(40.076948, 116.302963), (40.083291, 116.322045)], [(40.076948, 116.302963), (40.089172, 116.302284)], [(40.076948, 116.302963), (40.087389, 116.300231)], [(40.076948, 116.302963), (40.043761, 116.285851)], [(40.076948, 116.302963), (40.098774, 116.302953)], [(40.076948, 116.302963), (40.087491, 116.324951)], [(40.076948, 116.302963), (40.099121, 116.338071)], [(40.076948, 116.302963), (40.077062, 116.325645)], [(40.076948, 116.302963), (40.069228, 116.299637)], [(40.112621, 116.289151), (40.125517, 116.261944)], [(40.112621, 116.289151), (40.118531, 116.267087)], [(40.112621, 116.289151), (40.131848, 116.266921)], [(40.038109, 116.323645), (40.039607, 116.316384)], [(40.118531, 116.267087), (40.120147, 116.254641)], [(40.118531, 116.267087), (40.131848, 116.266921)], [(40.118531, 116.267087), (40.106016, 116.276689)], [(40.118531, 116.267087), (40.125517, 116.261944)], [(40.118531, 116.267087), (40.218981, 116.230971)], [(40.118531, 116.267087), (40.125971, 116.252163)], [(40.034261, 116.358151), (40.040439, 116.349094)], [(40.145939, 116.252157), (40.125517, 116.261944)], [(40.145939, 116.252157), (40.218981, 116.230971)], [(40.081833, 116.294194), (40.098774, 116.302953)], [(40.081833, 116.294194), (40.235611, 116.124289)], [(40.081833, 116.294194), (40.089172, 116.302284)], [(40.043501, 116.298251), (40.043761, 116.285851)], [(40.043501, 116.298251), (40.055121, 116.307781)], [(40.043501, 116.298251), (40.034579, 116.288291)], [(40.043501, 116.298251), (40.034031, 116.319871)], [(40.125517, 116.261944), (40.209278, 116.216359)], [(40.125517, 116.261944), (40.213888, 116.221534)], [(40.125517, 116.261944), (40.131848, 116.266921)], [(40.125517, 116.261944), (40.120147, 116.254641)], [(40.125517, 116.261944), (40.152972, 116.298361)], [(40.125517, 116.261944), (40.141792, 116.258313)], [(40.125517, 116.261944), (40.103275, 116.284444)], [(40.108971, 116.268313), (40.106016, 116.276689)], [(40.213869, 116.234626), (40.215364, 116.240961)], [(40.213869, 116.234626), (40.210773, 116.239262)], [(40.213869, 116.234626), (40.211233, 116.239117)], [(40.213869, 116.234626), (40.212442, 116.246563)], [(40.213869, 116.234626), (40.209278, 116.216359)], [(40.213869, 116.234626), (40.216783, 116.256904)], [(40.213869, 116.234626), (40.209889, 116.228222)], [(40.213869, 116.234626), (40.220667, 116.239556)], [(40.213869, 116.234626), (40.212647, 116.251881)], [(40.213869, 116.234626), (40.213888, 116.221534)], [(40.213869, 116.234626), (40.218981, 116.230971)], [(40.213869, 116.234626), (40.212898, 116.228058)], [(40.213869, 116.234626), (40.183412, 116.232075)], [(40.213869, 116.234626), (40.214867, 116.247008)], [(40.212898, 116.228058), (40.210773, 116.239262)], [(40.212898, 116.228058), (40.211233, 116.239117)], [(40.212898, 116.228058), (40.213888, 116.221534)], [(40.212898, 116.228058), (40.209889, 116.228222)], [(40.212898, 116.228058), (40.220667, 116.239556)], [(40.212898, 116.228058), (40.218981, 116.230971)], [(40.212647, 116.251881), (40.214867, 116.247008)], [(40.212647, 116.251881), (40.210773, 116.239262)], [(40.212647, 116.251881), (40.212442, 116.246563)], [(40.212647, 116.251881), (40.216783, 116.256904)], [(39.787638, 116.493917), (39.790501, 116.483001)], [(39.787638, 116.493917), (39.787601, 116.493901)], [(39.787638, 116.493917), (39.790141, 116.482981)], [(39.787638, 116.493917), (40.187917, 117.153667)], [(39.787638, 116.493917), (39.792501, 116.486851)], [(40.033701, 116.330251), (40.039222, 116.339751)], [(40.039607, 116.316384), (40.034978, 116.306693)], [(40.039607, 116.316384), (40.034031, 116.319871)], [(40.039607, 116.316384), (40.041002, 116.315417)], [(40.034031, 116.319871), (40.034978, 116.306693)], [(40.034031, 116.319871), (40.034579, 116.288291)], [(40.040439, 116.349094), (40.058111, 116.330667)], [(40.040439, 116.349094), (40.041361, 116.373921)], [(40.154301, 116.250241), (40.156415, 116.244773)], [(40.154301, 116.250241), (40.158691, 116.266905)], [(40.034579, 116.288291), (40.034978, 116.306693)], [(40.103275, 116.284444), (40.106016, 116.276689)], [(40.103275, 116.284444), (40.098981, 116.285883)], [(40.083291, 116.322045), (40.089172, 116.302284)], [(40.083291, 116.322045), (40.098774, 116.302953)], [(40.083291, 116.322045), (40.087491, 116.324951)], [(40.083291, 116.322045), (40.099121, 116.338071)], [(40.083291, 116.322045), (40.077062, 116.325645)], [(40.083291, 116.322045), (40.068287, 116.333102)], [(40.083291, 116.322045), (40.081066, 116.342998)], [(40.083291, 116.322045), (40.084444, 116.331417)], [(40.087389, 116.300231), (40.089172, 116.302284)], [(40.156415, 116.244773), (40.197801, 116.222841)], [(40.156415, 116.244773), (40.158691, 116.266905)], [(40.150118, 116.264351), (40.146371, 116.273861)], [(40.218981, 116.230971), (40.210773, 116.239262)], [(40.218981, 116.230971), (40.212442, 116.246563)], [(40.218981, 116.230971), (40.197801, 116.222841)], [(40.218981, 116.230971), (40.222097, 116.220571)], [(40.218981, 116.230971), (40.209889, 116.228222)], [(40.218981, 116.230971), (40.220667, 116.239556)], [(40.218981, 116.230971), (40.213888, 116.221534)], [(40.218981, 116.230971), (40.152972, 116.298361)], [(40.084444, 116.331417), (40.087491, 116.324951)], [(40.084444, 116.331417), (40.099121, 116.338071)], [(40.084444, 116.331417), (40.068287, 116.333102)], [(40.084444, 116.331417), (40.081066, 116.342998)], [(40.084444, 116.331417), (40.152972, 116.298361)], [(40.461806, 115.968917), (40.462333, 115.980861)], [(40.461806, 115.968917), (40.464911, 115.992917)], [(40.461806, 115.968917), (40.463311, 115.970806)], [(40.055791, 116.324361), (40.058111, 116.330667)], [(40.055791, 116.324361), (40.065611, 116.322079)], [(39.790501, 116.483001), (39.790141, 116.482981)], [(39.790501, 116.483001), (40.187917, 117.153667)], [(39.790501, 116.483001), (39.792501, 116.486851)], [(40.209889, 116.228222), (40.210773, 116.239262)], [(40.209889, 116.228222), (40.211233, 116.239117)], [(40.209889, 116.228222), (40.222097, 116.220571)], [(40.209889, 116.228222), (40.220667, 116.239556)], [(40.220667, 116.239556), (40.215364, 116.240961)], [(40.220667, 116.239556), (40.210773, 116.239262)], [(40.220667, 116.239556), (40.222097, 116.220571)], [(40.220667, 116.239556), (40.167991, 116.314012)], [(40.220667, 116.239556), (40.223035, 116.276701)], [(40.462333, 115.980861), (40.463311, 115.970806)], [(40.095381, 116.283131), (40.106016, 116.276689)], [(40.095381, 116.283131), (40.098981, 116.285883)], [(40.095381, 116.283131), (40.089172, 116.302284)], [(40.210773, 116.239262), (40.215364, 116.240961)], [(40.210773, 116.239262), (40.222097, 116.220571)], [(40.210773, 116.239262), (40.211233, 116.239117)], [(40.210773, 116.239262), (40.212442, 116.246563)], [(40.210773, 116.239262), (40.214867, 116.247008)], [(40.211233, 116.239117), (40.212442, 116.246563)], [(40.212442, 116.246563), (40.215364, 116.240961)], [(40.212442, 116.246563), (40.214867, 116.247008)], [(40.212442, 116.246563), (40.222097, 116.220571)], [(40.212442, 116.246563), (40.216783, 116.256904)], [(40.222097, 116.220571), (40.145755, 116.302861)], [(40.222097, 116.220571), (40.213888, 116.221534)], [(40.222097, 116.220571), (40.220905, 116.213595)], [(40.120147, 116.254641), (40.125971, 116.252163)], [(40.120147, 116.254641), (40.131848, 116.266921)], [(40.125971, 116.252163), (40.131848, 116.266921)], [(40.216801, 116.203957), (40.183415, 116.161574)], [(40.220905, 116.213595), (40.235611, 116.124289)], [(40.220905, 116.213595), (40.213888, 116.221534)], [(40.170417, 116.269783), (40.141792, 116.258313)], [(40.170417, 116.269783), (40.158691, 116.266905)], [(40.065611, 116.322079), (40.058111, 116.330667)], [(40.065611, 116.322079), (40.055121, 116.307781)], [(40.065611, 116.322079), (40.052505, 116.173674)], [(40.065611, 116.322079), (40.068287, 116.333102)], [(40.065611, 116.322079), (40.051301, 116.311001)], [(40.197801, 116.222841), (40.209278, 116.216359)], [(40.131848, 116.266921), (40.145014, 116.293074)], [(40.131848, 116.266921), (40.146371, 116.273861)], [(40.145014, 116.293074), (40.145755, 116.302861)], [(40.145014, 116.293074), (40.152972, 116.298361)], [(40.145014, 116.293074), (40.146371, 116.273861)], [(40.152972, 116.298361), (40.145755, 116.302861)], [(40.152972, 116.298361), (40.167991, 116.314012)], [(40.152972, 116.298361), (40.141792, 116.258313)], [(40.043761, 116.285851), (40.051301, 116.311001)], [(40.047312, 116.333848), (40.058111, 116.330667)], [(40.047312, 116.333848), (40.052505, 116.173674)], [(40.098774, 116.302953), (40.098981, 116.285883)], [(40.122783, 116.319914), (40.099121, 116.338071)], [(40.122783, 116.319914), (40.106016, 116.276689)], [(40.122783, 116.319914), (40.136843, 116.314051)], [(40.087491, 116.324951), (40.089172, 116.302284)], [(40.087491, 116.324951), (40.099121, 116.338071)], [(40.087491, 116.324951), (40.077062, 116.325645)], [(40.087491, 116.324951), (40.081066, 116.342998)], [(40.081066, 116.342998), (40.099121, 116.338071)], [(40.106016, 116.276689), (40.098981, 116.285883)], [(40.062711, 116.295361), (39.898054, 116.219284)], [(40.062711, 116.295361), (40.052505, 116.173674)], [(40.062711, 116.295361), (40.068287, 116.333102)], [(40.062711, 116.295361), (40.096239, 116.272141)], [(40.032181, 116.340731), (39.790141, 116.482981)], [(40.032181, 116.340731), (40.034231, 116.327471)], [(40.032181, 116.340731), (40.039222, 116.339751)], [(40.052505, 116.173674), (40.034978, 116.306693)], [(40.052505, 116.173674), (40.069228, 116.299637)], [(40.052505, 116.173674), (40.051301, 116.311001)], [(39.790141, 116.482981), (40.187917, 117.153667)], [(40.214867, 116.247008), (40.215364, 116.240961)], [(40.168968, 116.311797), (40.167991, 116.314012)], [(40.096239, 116.272141), (40.158691, 116.266905)], [(40.077062, 116.325645), (40.099121, 116.338071)], [(40.077062, 116.325645), (40.068287, 116.333102)], [(39.787601, 116.493901), (39.792501, 116.486851)], [(40.051301, 116.311001), (40.055121, 116.307781)], [(40.051301, 116.311001), (40.034978, 116.306693)], [(40.034978, 116.306693), (40.022108, 116.307999)], [(40.066778, 116.342167), (40.066421, 116.341311)], [(40.066778, 116.342167), (40.068287, 116.333102)], [(40.069228, 116.299637), (40.068287, 116.333102)], [(39.947101, 116.309841), (40.089172, 116.302284)], [(40.464911, 115.992917), (40.447056, 115.968972)], [(40.136843, 116.314051), (40.145755, 116.302861)], [(40.136843, 116.314051), (40.167991, 116.314012)], [(40.146371, 116.273861), (40.089172, 116.302284)], [(40.145755, 116.302861), (40.167991, 116.314012)], [(40.209278, 116.216359), (40.213888, 116.221534)], [(40.068287, 116.333102), (40.058111, 116.330667)], [(40.057821, 116.340871), (40.058111, 116.330667)], [(40.167991, 116.314012), (40.166291, 116.343241)]], 12285: [[(39.923121, 116.515441), (39.915401, 116.556331)], [(39.923121, 116.515441), (39.921471, 116.399411)], [(39.923121, 116.515441), (39.910051, 116.514661)], [(39.923121, 116.515441), (39.918611, 116.507181)], [(39.923121, 116.515441), (39.920111, 116.546667)], [(39.923121, 116.515441), (39.926101, 116.528501)], [(40.005278, 116.223278), (39.912491, 116.533221)], [(39.938245, 116.570841), (39.920071, 116.536031)], [(39.917778, 116.555001), (39.920111, 116.546667)], [(39.918611, 116.507181), (39.921181, 116.494821)], [(39.916032, 116.529796), (39.912491, 116.533221)], [(39.921181, 116.494821), (39.920071, 116.536031)], [(39.918681, 116.507301), (39.925291, 116.472391)], [(39.910051, 116.514661), (39.912917, 116.518306)], [(39.916191, 116.528441), (39.917275, 116.524194)], [(39.916191, 116.528441), (39.912101, 116.354001)], [(39.916191, 116.528441), (39.918461, 116.523139)], [(39.911641, 116.547851), (39.920071, 116.536031)], [(39.911641, 116.547851), (39.915401, 116.556331)], [(39.887901, 116.331001), (39.920071, 116.536031)], [(39.887901, 116.331001), (40.039091, 116.305781)], [(39.907611, 116.572151), (39.920071, 116.536031)], [(39.857296, 116.078922), (39.920071, 116.536031)], [(39.857296, 116.078922), (39.915401, 116.556331)], [(39.920071, 116.536031), (39.909691, 116.591661)], [(39.920071, 116.536031), (39.912491, 116.533221)], [(39.920071, 116.536031), (39.915401, 116.556331)], [(39.920071, 116.536031), (39.976213, 116.573121)], [(39.920071, 116.536031), (39.908941, 116.525101)], [(39.920071, 116.536031), (40.008061, 116.448869)], [(39.920071, 116.536031), (39.837781, 116.389081)], [(39.920071, 116.536031), (39.926101, 116.528501)], [(39.865821, 116.488651), (39.912491, 116.533221)], [(40.129231, 117.106491), (39.892091, 116.392511)], [(39.920111, 116.546667), (39.915401, 116.556331)], [(39.912101, 116.354001), (39.912491, 116.533221)], [(39.912491, 116.533221), (39.908941, 116.525101)], [(39.912491, 116.533221), (40.039091, 116.305781)], [(39.912491, 116.533221), (39.915401, 116.556331)], [(39.912491, 116.533221), (39.913461, 116.430731)], [(39.915401, 116.556331), (39.920889, 116.557278)], [(39.915401, 116.556331), (39.908941, 116.525101)]]} # In[13]: nodeLoc = [(40.200491, 116.179253), (39.988228, 116.308678), (39.990111, 116.330251), (40.226655, 116.226144), (39.918611, 116.507181), (40.005278, 116.223278), (39.917778, 116.555001), (40.055072, 116.313491), (40.129231, 117.106491), (40.171594, 116.244031), (40.050083, 116.298417), (40.136153, 116.132506), (40.100662, 116.276404), (39.920111, 116.546667), (39.988231, 116.311401), (40.216718, 116.216522), (40.029814, 116.317095), (40.056215, 116.327246), (40.240347, 116.117703), (40.133908, 116.260049), (40.073638, 116.310218), (39.910051, 116.514661), (40.073022, 116.316664), (39.933961, 116.724013), (39.983464, 116.308398), (40.017394, 116.325471), (40.026111, 116.304511), (40.231194, 116.118111), (39.908941, 116.525101), (39.920071, 116.536031), (39.916111, 116.525556), (40.052918, 116.369476), (40.140561, 116.262416), (39.975395, 116.313438), (40.134251, 116.252193), (40.035833, 116.309445), (40.206013, 116.223627), (40.037177, 116.370581), (40.076948, 116.302963), (39.921471, 116.399411), (39.865821, 116.488651), (40.112621, 116.289151), (39.837781, 116.389081), (40.038109, 116.323645), (39.993301, 116.385501), (40.072862, 116.403417), (40.118531, 116.267087), (40.034261, 116.358151), (39.912101, 116.354001), (40.145939, 116.252157), (40.081833, 116.294194), (40.050472, 116.321388), (40.045489, 116.345215), (39.983471, 116.308391), (40.043501, 116.298251), (40.125517, 116.261944), (40.108971, 116.268313), (40.213869, 116.234626), (40.212898, 116.228058), (39.981928, 116.308731), (39.991361, 116.309306), (40.112222, 116.285388), (40.369497, 115.888276), (39.979381, 116.308711), (39.884931, 116.672281), (39.990311, 116.351102), (40.212647, 116.251881), (40.036487, 116.340494), (39.787638, 116.493917), (40.023842, 116.331927), (40.033701, 116.330251), (40.039607, 116.316384), (40.034031, 116.319871), (39.994141, 116.405721), (40.040439, 116.349094), (39.914801, 116.469981), (40.154301, 116.250241), (40.034579, 116.288291), (40.103275, 116.284444), (40.083291, 116.322045), (39.980345, 116.370601), (39.925291, 116.472391), (39.895711, 116.397971), (40.031751, 116.368056), (40.087389, 116.300231), (40.409112, 115.939973), (39.983118, 116.310884), (40.156415, 116.244773), (40.150118, 116.264351), (39.915401, 116.556331), (40.218981, 116.230971), (40.084444, 116.331417), (40.461806, 115.968917), (40.008171, 116.328254), (39.857296, 116.078922), (40.055791, 116.324361), (39.984811, 116.315931), (39.790501, 116.483001), (40.209889, 116.228222), (40.220667, 116.239556), (40.027911, 116.335911), (40.462333, 115.980861), (40.095381, 116.283131), (40.064501, 116.279917), (39.886583, 116.673001), (39.907611, 116.572151), (40.210773, 116.239262), (40.211233, 116.239117), (40.212442, 116.246563), (39.912491, 116.533221), (40.071389, 116.323528), (39.983031, 116.298521), (40.222097, 116.220571), (39.981862, 116.317841), (39.918461, 116.523139), (39.977147, 116.304633), (39.983056, 116.309167), (39.983333, 116.309944), (40.016147, 116.296344), (40.120147, 116.254641), (40.125971, 116.252163), (40.216801, 116.203957), (40.220905, 116.213595), (40.041002, 116.315417), (40.170417, 116.269783), (40.504195, 116.054002), (40.235611, 116.124289), (39.938245, 116.570841), (40.065611, 116.322079), (40.197801, 116.222841), (40.017402, 116.305637), (40.131848, 116.266921), (39.920349, 116.327869), (39.988501, 116.318872), (39.983061, 116.319341), (40.145014, 116.293074), (40.028271, 116.341911), (40.152972, 116.298361), (40.183412, 116.232075), (39.916032, 116.529796), (39.983334, 116.309945), (39.916191, 116.528441), (39.952309, 116.402426), (40.463311, 115.970806), (40.043761, 116.285851), (40.047312, 116.333848), (40.098774, 116.302953), (40.122783, 116.319914), (40.087491, 116.324951), (40.081066, 116.342998), (40.106016, 116.276689), (40.062711, 116.295361), (40.032181, 116.340731), (39.977181, 116.308881), (40.041361, 116.373921), (39.980015, 116.311137), (40.052505, 116.173674), (39.790141, 116.482981), (40.030933, 116.332812), (40.187917, 117.153667), (40.006201, 116.279001), (40.019626, 116.456913), (40.214867, 116.247008), (40.168968, 116.311797), (39.892091, 116.392511), (39.991104, 116.343872), (40.096239, 116.272141), (40.008801, 116.267881), (40.077062, 116.325645), (39.887901, 116.331001), (39.787601, 116.493901), (39.948201, 116.542001), (39.977189, 116.305564), (40.051301, 116.311001), (39.898054, 116.219284), (39.978871, 116.306551), (40.034978, 116.306693), (39.792501, 116.486851), (40.050981, 116.320021), (39.763371011, 116.322339649), (39.913461, 116.430731), (39.977501, 116.292001), (39.917275, 116.524194), (40.043889, 116.473056), (39.909691, 116.591661), (40.066778, 116.342167), (39.990531, 116.363311), (40.010696, 116.338602), (40.039091, 116.305781), (40.069228, 116.299637), (39.947101, 116.309841), (40.464911, 115.992917), (40.034231, 116.327471), (39.975028, 116.311556), (39.923121, 116.515441), (39.977237, 116.308991), (40.223035, 116.276701), (40.020209, 116.302722), (40.015131, 116.425051), (39.921181, 116.494821), (40.215364, 116.240961), (39.905001, 116.342225), (39.920889, 116.557278), (39.978994, 116.329721), (40.183415, 116.161574), (40.136843, 116.314051), (39.985921, 116.304434), (40.039222, 116.339751), (39.911641, 116.547851), (40.146371, 116.273861), (39.592431, 116.183104), (40.000241, 116.352881), (40.145755, 116.302861), (39.976213, 116.573121), (40.158691, 116.266905), (40.089172, 116.302284), (40.022108, 116.307999), (39.990301, 116.339161), (39.991541, 116.319551), (40.209278, 116.216359), (40.216783, 116.256904), (40.008061, 116.448869), (40.099121, 116.338071), (40.068287, 116.333102), (40.057821, 116.340871), (40.227885, 116.146042), (40.447056, 115.968972), (40.044503, 116.334486), (39.905408, 116.445833), (40.058111, 116.330667), (40.055121, 116.307781), (39.912917, 116.518306), (40.066421, 116.341311), (40.098981, 116.285883), (39.886901, 116.675301), (39.989352, 116.356064), (39.994901, 116.293001), (40.167991, 116.314012), (39.983211, 116.306881), (40.166291, 116.343241), (39.918681, 116.507301), (39.963305, 116.335277), (40.183997, 116.191357), (39.914001, 116.499361), (40.213888, 116.221534), (39.926101, 116.528501), (40.141792, 116.258313), (39.981691, 116.332721)] # In[ ]: