dbf_out.field_spec = [('N',20,0),('N',20,0),('L',1,0)] ids = id2coord.keys() ids.sort() for edge in edges: o = coords[edge[0]] d = coords[edge[1]] feat = ps.cg.Chain([o,d]) rec = (edge[0],edge[1],False) dbf_out.write(rec) shp_out.write(feat) dbf_out.close() shp_out.close() import net_shp_io file_name = "streets_net.shp" coords, edges = net_shp_io.reader(file_name) coords1, edges1 = net_shp_io.reader(file_name, doubleEdges=False) import wed wed_streets = wed.WED(edges, coords) #wed1_streets = wed.extract_wed(edges1, coords1) regions = wed_streets.region_edge.keys() # cleanup files = [ "streets_net."+suffix for suffix in "shp","dbf","shx"] for f in files:
dbl_edges = [] for e in edges: dbl_edges.append(e) dbl_edges.append((e[1], e[0])) wed_1 = extract_wed(dbl_edges, coords) print "Enumeration of links around nodes" for node in range(0, 26): print node, enum_links_node(wed_1, node) print "Enumeration of links around regions" for region in range(7): print region, enum_edges_region(wed_1, region) print "Eberly Shapefile (non-ordered nodes) Complete" # testing reader coords, edges = net_shp_io.reader("../contrib/spatialnet/eberly_net.shp") wed_2 = extract_wed(edges, coords) print "Enumeration of links around nodes" for node in range(0, 26): print node, enum_links_node(wed_1, node) print "Enumeration of links around regions" for region in range(7): print region, enum_edges_region(wed_1, region) print "Eberly read Shapefile (non-ordered nodes) Complete"
wed_1 = extract_wed(dbl_edges, coords) print "Enumeration of links around nodes" for node in range(0,26): print node, enum_links_node(wed_1, node) print "Enumeration of links around regions" for region in range(7): print region, enum_edges_region(wed_1, region) print "Eberly Shapefile (non-ordered nodes) Complete" # testing reader coords, edges = net_shp_io.reader("../contrib/spatialnet/eberly_net.shp") wed_2 = extract_wed(edges, coords) print "Enumeration of links around nodes" for node in range(0,26): print node, enum_links_node(wed_1, node) print "Enumeration of links around regions" for region in range(7): print region, enum_edges_region(wed_1, region) print "Eberly read Shapefile (non-ordered nodes) Complete"