简体   繁体   English

距离内的所有点

[英]all points within distance

I´m really desperate. 我真的很绝望。 What I wanna do ist: I have a list of 2d points 我想做什么:我有一个二维点列表

    L=[(22.37, 29.48), (20.50, 30.28), (20.50, 30.28), (20.77, 30.01), (20.77, 30.01), (21.04, 29.74), (21.04, 29.74), (22.58, 29.44), (22.78, 29.19), (23.11, 28.87)]

(my list has 30000 tuples (xn,yn)). (我的列表有30000个元组(xn,yn))。 Now I want all points within distance dmax (from every point). 现在,我希望距离dmax以内的所有点(从每个点开始)。 Therefor I used scipy.spatial.KDTree() and query_ball_point. 因此,我使用了scipy.spatial.KDTree()和query_ball_point。

    import scipy.spatial
    tree = scipy.spatial.KDTree(XY)
    k=np.array(tree.query_ball_tree(tree, dmax))   

For my first point I get 关于我的第一点

    array([ [ 12475L, 12476L, 15081L, 15082L, 15083L, 22380L, 22381L, 22562L, 22379L, 12469L, 12470L, 13469L, 13470L, 13471L, 13472L, 15084L, 15085L, 15086L, 15087L, 14L, 15L, 16L, 13468L, 22374L, 22375L, 22376L, 22377L, 22378L, 22557L, 22558L, 22559L, 22560L, 22561L, 23091L, 22503L, 22504L, 22505L, 1L, 2L, 3L, 4L, 5L, 6L,...]])

Why there are these 'L's?? 为什么会有这些“ L”? How can I remove these? 如何删除这些?

Thanks for help! 感谢帮助!

They're long integers. 它们是长整数。 It's not hard to find stuff like this yourself, try googling for 'python numbers with L' and you would find similar questions like Why do integers in database row tuple have an 'L' suffix? 自己找到这样的东西并不难,尝试使用“带有L的python数字”进行谷歌搜索,您会发现类似的问题,例如为什么数据库行元组中的整数后缀为“ L”? :) :)

不需要做任何事情,它们是长整数,您可以通过使用它们来进行计算。

The L won't have any effect as others have pointed out, you will still be able to use those numbers to access an array by index - why don't you just try it?. L不会像其他人指出的那样起作用,您仍然可以使用这些数字按索引访问数组-为什么不尝试呢? For more information you should read about Integers in computer science . 有关更多信息,您应该阅读有关计算机科学中的整数的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM