Shapely Linestring:如何使用“ my quot”进行投影距离?
我有一个line = linestring([[P0,P1,P2,P3])
,我想将点p
投影到其中,但有一个扭曲。
如果我做line.project(p)
,则沿line
从p0
开始在平面中测量结果。但是我需要知道投影是否位于p0
和p1
之间,还是p1
和p2
等之间。因此,我需要一个从0
到1
的浮子,如果P
项目到段[P0,P1]
,或范围从1
到2
如果P
项目到[P1,P2]
等。
我的用例是:假设p0,p1,p2,p3
是对象的位置t = 0、1、2、3
。然后,我需要知道对象在何时传递到p
的最接近。知道它从p0
传播的程度,这是不同的,这是project
给我的。
我目前正在使用片段对进行 linestring([pi,pi+1])和使用project
对每个人,选择最接近的一个。这有效,但可能会有更好的东西。
I have a line = LineString([p0, p1, p2, p3])
and I want to project a pointp
into it but with a twist.
If I do line.project(p)
, the result is measured in the plane along line
starting at p0
. But I need to know whether the projection lies between p0
and p1
, or between p1
and p2
, etc. So I need a float that ranges from 0
to 1
if p
projects to the segment [p0, p1]
, or ranges from 1
to 2
if p
projects to [p1, p2]
, etc.
My use case is this: assume p0, p1, p2, p3
are the positions of an object at times t=0, 1, 2, 3
. Then I need to know at which time the object passed the closest to p
. This is different to know how much it had traveled from p0
, which is what project
gives me.
I'm currently doing a for
with the segments LineString([pi, pi+1])
and using project
against each of them, to select the closest one. This works, but there might be something better.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论