Clean-up use of impl/lgeos/delegated/exceptNull in shapely/geometry/#1020
Conversation
|
|
||
| assert empty_line.is_empty | ||
| interpolated_point = empty_line.interpolate(.5, normalized=True) | ||
| assert interpolated_point.is_empty |
There was a problem hiding this comment.
This test/behaviour comes from #653. GEOS segfaults when passing an empty linestring, and Shapely solved this with the exceptNull decorator checking if any of the arguments was empty. PyGEOS currently also checks for this explicitly (to avoid the segfault, see https://github.com/pygeos/pygeos/blob/32397d998d2fc7fe3afef673539dace9fd8efe7f/src/geos.c#L297), but we decided to return an empty point instead of raising an error (see https://github.com/pygeos/pygeos/blob/32397d998d2fc7fe3afef673539dace9fd8efe7f/src/ufuncs.c#L373)
Any strong opinions on the desired behaviour?
There was a problem hiding this comment.
This change of behavior is welcome, particularly since this is what PostGIS does:
db=> SELECT ST_AsText(ST_LineInterpolatePoint('LINESTRING EMPTY'::geometry, 0.2));
st_astext
-------------
POINT EMPTY
(1 row)
69d2fe2 to
bfe4149
Compare
mwtoews
left a comment
There was a problem hiding this comment.
Looks good. I see the remaining delegated functions are in shapely.prepared, which I suspect will be addressed later (as discussed in shapely/shapely-rfc#1)
Indeed, and the same for the |
|
Also removed any remaining use of |
c6154f3 to
3e08f95
Compare
2e6e3f7 to
0d9afea
Compare
|
Needed to do a force-push to this branch, because I rebased the |
|
CI is failing because of a build failure with pygeos (opened pygeos/pygeos#260 for that). |
3e08f95 to
e0d3c53
Compare
0d9afea to
ccd5995
Compare
|
Actually, GEOSVERSION changed to GEOS_VERSION, so that was the cause ;) |
|
OK, remaining failure is a doctest failure unrelated to this PR, so will fix that in a separate PR (we started checking the doctests on master, which was now brought into shapely-2.0 branch, and there are some failures now) |
Follow-up on #983, cleaning up a few more things in geometry/base.py
delegateddecorator is no longer needed (no support for another "impl"), also removed the tests for thisprojectis already implemented by PyGEOS, so using that one (same forrelateandrelate_patternnow)exceptNulldecorator, as such error handling is now handled in pygeos C code. For interpolate, we only have a slight difference in behaviour, though (for which I updated the test), see inline comment.self.impl, since this is now no longer rused