Shapely Linestring:如何使用“ my quot”进行投影距离?

发布于 2025-02-11 13:41:33 字数 719 浏览 1 评论 0原文

我有一个line = linestring([[P0,P1,P2,P3]),我想将点p投影到其中,但有一个扭曲。

如果我做line.project(p),则沿linep0开始在平面中测量结果。但是我需要知道投影是否位于p0p1之间,还是p1p2等之间。因此,我需要一个从01的浮子,如果P项目到段[P0,P1] ,或范围从12如果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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文