uscuni / simplification

Simplification of street network geometry
Other
6 stars 0 forks source link

add docstring and test for `core/geometry.py` #73

Closed jGaboardi closed 5 days ago

jGaboardi commented 1 week ago
martinfleis commented 1 week ago

heeey, that is unfair, there's a docstring :D

jGaboardi commented 1 week ago

OK --> "Jame needs to feel relevant and useful by ensuring unnecessary completeness on Martin's great docstring"

martinfleis commented 1 week ago

I'll take that :D

jGaboardi commented 1 week ago

@martinfleis Is this expected behavior?

In [1]: import shapely, core
   ...: polygon = shapely.Polygon(
   ...:     (((0,0), (10,0), (10,10), (0,10), (0,0)))
   ...: )
   ...: line = shapely.LineString(((5,5), (100,5)))
   ...: core.geometry.is_within(line, polygon)
Out[1]: True

Basically, a small box where a line starts within the box, but the overwhelming majority of the line is outside the box. I interpret the tol parameter to relax the tolerance just a bit to handle cases where a line is mostly within a polygon.

martinfleis commented 1 week ago

Nope, that is not expected.

jGaboardi commented 1 week ago

found the bug

jGaboardi commented 1 week ago

https://github.com/uscuni/simplification/blob/fcae9daab634bf963a4b364f2980d89720b54c23/core/geometry.py#L8

jGaboardi commented 1 week ago

tol should be -1e6