@@ -242,7 +242,8 @@ def nodes_edges_to_G(node_loc_dic, edge_dic, name='glurp'):
242
242
G = nx .MultiDiGraph ()
243
243
# set graph crs and name
244
244
G .graph = {'name' : name ,
245
- 'crs' : {'init' : 'epsg:4326' }
245
+ # 'crs': {'init': 'epsg:4326'}
246
+ 'crs' : 'epsg:4326'
246
247
}
247
248
248
249
# add nodes
@@ -831,6 +832,7 @@ def wkt_to_G(params):
831
832
if verbose :
832
833
print (" len(G.nodes():" , len (G0 .nodes ()))
833
834
print (" len(G.edges():" , len (G0 .edges ()))
835
+ print (" G0.graph['crs']" , G0 .graph ['crs' ])
834
836
#for edge_tmp in G0.edges():
835
837
# print ("\n 0 wtk_to_G():", edge_tmp, G0.edge[edge_tmp[0]][edge_tmp[1]])
836
838
@@ -872,7 +874,6 @@ def wkt_to_G(params):
872
874
873
875
#edge_tmp = G0.edges()[5]
874
876
#print (edge_tmp, "G0.edge props:", G0.edge[edge_tmp[0]][edge_tmp[1]])
875
-
876
877
877
878
# geo coords
878
879
if im_file :
@@ -913,8 +914,17 @@ def wkt_to_G(params):
913
914
914
915
if verbose :
915
916
print ("projecting graph..." )
916
- G_projected = ox .project_graph (G1 )
917
-
917
+ try :
918
+ G_projected = ox .project_graph (G1 )
919
+ except :
920
+ # make sure points have a geom
921
+ for i , (n , attr_dict ) in enumerate (G1 .nodes (data = True )):
922
+ # lon, lat = coords_dict[n]
923
+ node_geom = Point (attr_dict ['x' ], attr_dict ['y' ])
924
+ attr_dict ['geometry' ] = node_geom
925
+ print ("ox.is_crs_utm(G1.graph.crs)" , ox .is_crs_utm (G1 .graph .crs ))
926
+ G_projected = ox .project_graph (G1 )
927
+
918
928
# get geom wkt (for printing/viewing purposes)
919
929
for i ,(u ,v ,attr_dict ) in enumerate (G_projected .edges (data = True )):
920
930
if 'geometry' in attr_dict .keys ():
0 commit comments