pyqtree module

API Documentation

Classes

class Index

The top spatial index to be created by the user. Once created it can be populated with geographically placed members that can later be tested for intersection with a user inputted geographic bounding box. Note that the index can be iterated through in a for-statement, which loops through all all the quad instances and lets you access their properties.

 

Ancestors (in MRO)

Methods

def __init__(

self, bbox, maxitems=10, maxdepth=20)

Parameters:

  • bbox: The coordinate system bounding box of the area that the quadtree should keep track of, as a 4-length sequence (xmin,ymin,xmax,ymax)
  • maxmembers (optional): The maximum number of items allowed per quad before splitting up into four new subquads. Default is 10.
  • maxdepth (optional): The maximum levels of nested subquads, after which no more splitting occurs and the bottommost quad nodes may grow indefinately. Default is 20.
 

def countmembers(

self)

Returns:

  • A count of the total number of members/items/nodes inserted into this quadtree and all of its child trees.
 

def insert(

self, item, bbox)

Inserts an item into the quadtree along with its bounding box.

Parameters:

  • item: The item to insert into the index, which will be returned by the intersection method
  • bbox: The spatial bounding box tuple of the item, with four members (xmin,ymin,xmax,ymax)
 

def intersect(

self, bbox)

Intersects an input boundingbox rectangle with all of the items contained in the quadtree.

Parameters:

  • bbox: A spatial bounding box tuple with four members (xmin,ymin,xmax,ymax)

Returns:

  • A list of inserted items whose bounding boxes intersect with the input rectangle.

Here are the examples of the python api pyqtree.Index taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples

3

Example 1

Project: joerd 
Source File: index.py

View license

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def create(index_file, bbox, parse_fn, *parse_args):
    logger = logging.getLogger("index")
    idx = pyqtree.Index(bbox=bbox)
    n = 0
 
    with open(index_file, 'r') as f:
        files = yaml.load(f)
        for f in files:
            t = parse_fn(f, *parse_args)
            if t:
                idx.insert(bbox=t.bbox.bounds, item=t)
                n += 1
 
    logger.info("Created index with %d objects." % n)
    return idx
3

Example 2

Project: gtfslib-python 
Source File: spatial.py

View license

1
2
3
4
5
6
7
def __init__(self, D0):
    self._D0 = 1. * D0
    bbox = (-180, -90, 180, 90)
    self._spidx = pyqtree.Index(bbox)
    self._points = []
    self._clusters_by_item = None
    self._clusters = None

pyqtree的更多相关文章

随机推荐

  1. 数据库原理及应用-数据库管理系统 DBMS

    2018-02-20 14:35:34 数据库管理系统(英语:database management system,缩写:DBMS) 是一种针对对象数据库,为管理数据库而设计的大型电脑软件管理系统.具 ...

  2. 新旧版ubuntu镜像免费下载

    链接:https://pan.baidu.com/s/1hUNfiyA_Npj9QQ0vNLJ_Xw 密码:6k6i

  3. MyBatis的返回参数类型

    MyBatis的返回参数类型分两种 1. 对应的分类为: 1.1.resultMap: 1.2.resultType: 2 .对应返回值类型: 2.1.resultMap:结果集 2.2.result ...

  4. css3 transform matrix矩阵的使用

      Transform 执行顺序问题 — 后写先执行 matrix(a,b,c,d,e,f) 矩阵函数 •通过矩阵实现缩放 x轴缩放 a=x*a    c=x*c     e=x*e; y轴缩放 b= ...

  5. iOS-如何写好一个UITableView

    如何写好一个UITableView 字数5787 阅读3745 评论25 喜欢69 本文是直播分享的简单文字整理,直播共分为上.下两部分.第一部分:优酷 Or YouTube,第二部分:优酷 Demo ...

  6. OGRE渲染流程

    本文为大便一箩筐的原创内容,转载请注明出处,谢谢:http://www.cnblogs.com/dbylk/

  7. vue-router防跳墙控制

    vue-router防跳墙控制 因为在实际开发中,从自己的角度来看,发现可以通过地址栏输入地址,便可以进入本没有权限的网页.而我们一般只是操作登录页面,其他页面很少考虑,此刻特来尝试解决一下 基于vu ...

  8. SQL基础整理(事务)

    事务==流程控制 确保流程只能成功或者失败,若出现错误会自动回到原点 具体的实现代码如下: begin tran insert into student values(') goto tranroll ...

  9. 【转】busybox分析——arp设置ARP缓存表中的mac地址

    [转]busybox分析——arp设置ARP缓存表中的mac地址 转自:http://blog.chinaunix.net/uid-26009923-id-5098083.html 1. 将arp缓存 ...

  10. 【跟着stackoverflow学Pandas】add one row in a pandas.DataFrame -DataFrame添加行

    最近做一个系列博客,跟着stackoverflow学Pandas. 以 pandas作为关键词,在stackoverflow中进行搜索,随后安照 votes 数目进行排序: https://stack ...