Shapely: 来自 LineString.interpolate() 的分段错误

创建于 2018-10-30  ·  5评论  ·  资料来源: Toblerity/Shapely

@snorfalorpagus ,给你:

预期行为和实际行为。

尝试沿LINESTRING EMPTY对象插入一个点时应该抛出回溯或警告,但会使内核崩溃。

重现问题的步骤

  • 导致死内核的笔记本中的.png问题报告结束)
  • 此代码块(如下)导致分段错误:
# python shapely_interpolate_segmentation_fault.py
import faulthandler
faulthandler.enable()
from shapely.geometry import Point, LineString
test_line = LineString(((0,0), (1,1), (2,1)))
print(test_line)
empty_line = test_line.parallel_offset(10., side='right')
print(empty_line)
empty_line.interpolate(.5, normalized=True)
$ python shapely_interpolate_segmentation_fault.py
LINESTRING (0 0, 1 1, 2 1)
LINESTRING EMPTY
Fatal Python error: Segmentation fault

Current thread 0x000000010ce7f5c0 (most recent call first):
  File "/Users/user/miniconda3/envs/py3_at1866/lib/python3.6/site-packages/shapely/linref.py", line 22 in __call__
  File "/Users/user/miniconda3/envs/py3_at1866/lib/python3.6/site-packages/shapely/geometry/base.py", line 777 in interpolate
  File "/Users/user/miniconda3/envs/py3_at1866/lib/python3.6/site-packages/shapely/impl.py", line 37 in wrapper
  File "shapely_interpolate_segmentation_fault.py", line 9 in <module>
Segmentation fault: 11

操作系统

  • Mac OS X 10.14

匀称的版本和出处

  • 1.6b4 从conda

dead_kernel

最有用的评论

嗯,有一个 exceptNull 装饰器,但它似乎没有被经常使用。 可能在这里很完美?

https://github.com/Toblerity/Shapely/blob/master/shapely/geometry/base.py#L160

https://github.com/Toblerity/Shapely/search?q=exceptnull&unscoped_q=exceptnull

所有5条评论

嗯,有一个 exceptNull 装饰器,但它似乎没有被经常使用。 可能在这里很完美?

https://github.com/Toblerity/Shapely/blob/master/shapely/geometry/base.py#L160

https://github.com/Toblerity/Shapely/search?q=exceptnull&unscoped_q=exceptnull

@kannes我认为excepNull装饰器是正确的使用方法。 你想提交 PR 吗?

@snorfalorpagus @kannes我可以提交 PR。 它只是将exceptNull装饰器添加到interpolate吗?

+ 一个简单的单元测试

行。 我会努力让它今天提交。

使用GitHawk发送

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

dopplershift picture dopplershift  ·  3评论

mikedh picture mikedh  ·  6评论

ispmarin picture ispmarin  ·  3评论

pvalsecc picture pvalsecc  ·  4评论

LostFan123 picture LostFan123  ·  3评论