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. [Vue]组件——通过$emit为组件自定义事件

    1.在定义组件时调用内建的 $emit 方法并传入事件的名字,来向父级组件触发一个事件enlarge-text: Vue.component('blog-post', { props: ['post' ...

  2. MooseFS技术详解

    原文 http://www.tuicool.com/articles/vQvEZ3y MooseFS是一款具有冗余容错功能的分布式文件系统.它把数据分散在多台服务器上,确保一份数据多个备份副本,对外提 ...

  3. Mysql5.7基于日志转为基于事务主从复制

    将基于日志的复制变更为基于事务的复制 mysql版本要高于5.7.6 gtid_mode要设为off 处理步骤 详细步骤 1.查看主从mysql版本是否高于5.7.6 show variables l ...

  4. C++(三十二) — 常对象、常成员变量、常成员函数

    常量:对于既需要共享.又需要防止改变的数据.在程序运行期间不可改变. const 修饰的是对象中的 this 指针.所以不能被修改. 1.常对象 数据成员值在对象的整个生存期内不能改变.在定义时必须初 ...

  5. BOM-event事件

    添加事件监听 <button id="btnShoot">shoot</button><br> <button id="btnA ...

  6. nginx的编译,和简单的配置问题

    反向代理常见的lvs.haproxy. 缓存服务常见的.squid.vanish.常见的前端缓存.Apache是多进程的web服务器,Nginx是多线程的web服务器. Nginx的特点,对静态能力强 ...

  7. JQuery遍历CheckBox踩坑记

    $("#checkbox_id").attr("checked"); //获取一个CheckBox的状态(有没有被选中,返回true/false) $(&quo ...

  8. L162

    More than 250 corporate signatories joined together to try and deal with plastic pollution in an ann ...

  9. jquery设置控件位置的方法

    纯JS写法,代码如下: document.getElementById("child").style.left="800px";document.getElem ...

  10. iOS 11 实现App在禁止转屏的状态下网页播放器全屏

    禁止转屏是这个意思,在General中设置Device Orientation只有竖屏. 要点就是重写UIViewController的以下3个属性方法 系统的全屏视频播放器是AVFullScreen ...