avanetten / cresi

Road network extraction from satellite imagery, with speed and travel time estimates
Apache License 2.0
186 stars 63 forks source link

key error with Skeleton to graph in 05_wkt_to_G.py (UNABLE TO RUN) #18

Closed mlgen closed 3 years ago

mlgen commented 3 years ago

When running %run -i 05_wkt_to_G.py configs/dar_tutorial_cpu.json in dar_tutorial_cpu/cresi_cpu_part2.ipynb, I get the following error (the key 'geometry' is not present within G_projected.edges"

KeyError                               Traceback (most recent call last)
~/Desktop/cresi/cresi/05_wkt_to_G.py in <module>
   1281 ###############################################################################
   1282 if __name__ == "__main__":
-> 1283     main()

~/Desktop/cresi/cresi/05_wkt_to_G.py in main()
   1272         pool.map(wkt_to_G, params)
   1273     else:
-> 1274         wkt_to_G(params[0])
   1275 
   1276     tf = time.time()

~/Desktop/cresi/cresi/05_wkt_to_G.py in wkt_to_G(params)
    918         for i,(u,v,attr_dict) in enumerate(G_projected.edges(data=True)):
    919             print (attr_dict)
--> 920             attr_dict['geometry_wkt'] = attr_dict['geometry'].wkt
    921 
    922         if verbose:

KeyError: 'geometry'

I've also printed the keys/values in G_projected.edges here for example until it threw me that error:

{'start': 10000, 'start_loc_pix': (7350.0, 2.0), 'end': 10001, 'end_loc_pix': (7322.0, 53.0), 'length_pix': 58.180752831155424, 'wkt_pix': 'LINESTRING (7350 2, 7322 53)', 'geometry_pix': 'LINESTRING (7350 2, 7322 53)', 'osmid': 0, 'geometry_latlon_wkt': 'LINESTRING (39.27236399997931 -6.7580028000011, 39.27228839997933 -6.758140500001112)', 'geometry_utm_wkt': 'LINESTRING (530098.2259186266 9252994.531477312, 530089.8629878408 9252979.31387781)', 'length_latlon': 0.0001570880326449568, 'length_utm': 17.36415693108535, 'length': 17.36415693108535, 'utm_zone': 37, 'utm_letter': 'M'}
zaburo-ch commented 2 years ago

Hi @resnets. I am also having the same error, can you please share with us how you solved it?