def features_node_edge_graph(obj):
points = {}<EOL>features = obj['<STR_LIT>']<EOL>for feature in tqdm(obj['<STR_LIT>']):<EOL><INDENT>for (lon, lat) in geojson.utils.coords(feature):<EOL><INDENT>points.setdefault((lon, lat), <NUM_LIT:0>)<EOL>points[(lon, lat)] += <NUM_LIT:1><EOL><DEDENT><DEDENT>points = [p for (p, c) in points.items() if c > <NUM_LIT:1>]<EOL>features = [geojson.Point(p) for p in points]<EOL>for f in tqdm(obj['<STR_LIT>']):<EOL><INDENT>seqs = []<EOL>seq = []<EOL>for point in geojson.utils.coords(f):<EOL><INDENT>if len(seq) > <NUM_LIT:0>:<EOL><INDENT>seq.append(point)<EOL><DEDENT>if point in points:<EOL><INDENT>seq.append(point)<EOL>if len(seq) > <NUM_LIT:1> and seq[<NUM_LIT:0>] in points:<EOL><INDENT>seqs.append(seq)<EOL>seq = [point]<EOL><DEDENT><DEDENT><DEDENT>for seq in seqs:<EOL><INDENT>features.append(geojson.Feature(geometry={"<STR_LIT>":seq, "<STR_LIT:type>":f['<STR_LIT>']['<STR_LIT:type>']}, properties=f['<STR_LIT>'], type=f['<STR_LIT:type>']))<EOL><DEDENT><DEDENT>obj['<STR_LIT>'] = features<EOL>return obj<EOL>
Transform the features into a more graph-like structure by
appropriately splitting LineString features into two-point
"edges" that connect Point "nodes".