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. 微信开发中使用curl忽略https证书

    http://blog.csdn.net/ljh504429906/article/details/51103519 微信开发中需要使用http及https的post与get请求实现api的调用.   ...

  2. IDEA的Tomcat配置Web的项目创建以及Servlet简单运行。

    相关软件: 1.IDEA编译器 2.JDK 3.Tomcat          (相关软件都可以到官网上下载,老表提示:不要下载最新版本因为不要做试验品)   IDEA的安装非常简单,找好安装的盘,n ...

  3. Docker总结

    Docker总结 一.Docker简介 1.问题:为什么会有docker出现 一款产品从开发到上线,从操作系统,到运行环境,再到应用配置.作为开发+运维之间的协作我们需要关心很多东西,这也是很多互联网 ...

  4. HDU 5687 字典树入门

    Problem C Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total ...

  5. wordpress启动

    wordpress启动 公司需要使用到wordpress 特意下载源码进行研究,才发现里面都是.php文件,需要运行php而不得不去配置运行环境 步骤如下 Wampserver32 使用的360安装的 ...

  6. BOM-event事件

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

  7. lseek使用说明

    lseek使用说明 表头文件#include<sys/types.h>#include<unistd.h> 定义函数off_t lseek(int filde,off_t of ...

  8. 【lightoj-1024】Eid (高精度)

    [题意] 给定n个数,求这n个数的最小公倍数. [题解] 最小公倍数当然不能按常规方法来求,因为最大的数将近是10000^1000级别的.然鹅最小公倍数怎么搞呢? 这里发现了一个规律: 4 5 6 3 ...

  9. CI框架CodeIgniter伪静态各种服务器设置

    Apache服务器.htaccess伪静态设置 RewriteEngine on RewriteCond $1 !^(index\\.php|system\\.php|images|skin|js|l ...

  10. PHP exec()函数的介绍和使用DEMO

    exec()函数用来执行一个外部程序,我们再用这函数基本是在linux. 开启exec()函数: exec()函数是被禁用的,要使用这个函数必须先开启.首先是 要关掉 安全模式 safe_mode = ...