Skip to content

Commit

Permalink
add case3 test
Browse files Browse the repository at this point in the history
  • Loading branch information
jGaboardi committed Dec 13, 2020
1 parent 56a9600 commit 68d129f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tigernet/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ def setUp(self):
# Case 2: s-crossover
# ---> # line3, line5
# Case 3

self.line6, self.line6_idx = LineString(((2.5, 0.5), (2.5, 1.5))), 5
self.line7, self.line7_idx = LineString(((2.5, 1), (2.5, 2))), 6
geoms += [self.line6, self.line7]
rings += ["False", "False"]
# Case 4

# Case 5
Expand Down Expand Up @@ -253,6 +256,16 @@ def test_split_line_case2_standard_multipoint(self):
for cidx, coord in enumerate(xy):
self.assertEqual(list(observed_smp_split[lidx].xy[cidx]), coord)

def test_split_line_case3(self):
known_case3 = [[[2.5, 2.5], [0.5, 1.0]], [[2.5, 2.5], [1.0, 1.5]]]
idx = self.line6_idx
loi = self.gdf.loc[idx, self.g]
args, kwargs = (loi, idx), {"df": self.gdf, "geo_col": self.g}
observed_case3 = tigernet.utils._split_line(*args, **kwargs)
for lidx, xy in enumerate(known_case3):
for cidx, coord in enumerate(xy):
self.assertEqual(list(observed_case3[lidx].xy[cidx]), coord)


if __name__ == "__main__":
unittest.main()
2 changes: 2 additions & 0 deletions tigernet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1691,12 +1691,14 @@ def _find_break_locs(loi=None, breaks=None, ring_road=False):
# road multiple names, etc. for multiple sections of roadway which
# were then digitized as separate, stacked entities.
elif intersection_type == MultiLineString:
print("... Case 4...")
breaks = _make_break_locs(loi=loi, breaks=breaks, mline=True)

# Case 5
# - Complex intersection of points and Lines
# anomaly in digitization / unclear
elif intersection_type == GeometryCollection:
print("... Case 5...")
# points and line in the geometry collection
pts_in_gc = []
lns_in_gc = []
Expand Down

0 comments on commit 68d129f

Please sign in to comment.