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. 键盘对应数字-keycode值大全(转)

    event.keycode值大全   keycode 8 = BackSpace BackSpace    keycode 9 = Tab Tab    keycode 12 = Clear    k ...

  2. 二十七 Python分布式爬虫打造搜索引擎Scrapy精讲—通过自定义中间件全局随机更换代理IP

    设置代理ip只需要,自定义一个中间件,重写process_request方法, request.meta['proxy'] = "http://185.82.203.146:1080&quo ...

  3. Struts2异常处理配置

    <package name="lee" extends="struts-default"> <!--定义全局结构映射 --> <g ...

  4. CentOS6.6系统中安装配置Samba的教程

    Samba是在Linux和UNIX系统上实现SMB协议的一个免费软件,由服务器及客户端程序构成.SMB(Server Messages Block,信息服务块)是一种在局域网上共享文件和打印机的一种通 ...

  5. IOS-实战分享:实时美颜滤镜是怎样炼成的

    作者:琨君 原文链接:http://www.jianshu.com/p/945fc806a9b4 本文获作者授权转载 背景 前段时间由于项目需求,做了一个基于GPUImage的实时美颜滤镜.现在各种各 ...

  6. 使用curl调试openstack的api

    一 系统环境 OpenStack: Mitaka 工具: 最简单的工具:restclient,本次使用curl 二 开搞 访问openstack的API之前,用户使用用户名和密码向keystone进行 ...

  7. 对一致性Hash算法,Java代码实现的深入研究(转)

    转载:http://www.cnblogs.com/xrq730/p/5186728.html 一致性Hash算法 关于一致性Hash算法,在我之前的博文中已经有多次提到了,MemCache超详细解读 ...

  8. 35-THREE.JS 多面体

    <!DOCTYPE html> <html> <head> <title></title> <script src="htt ...

  9. 【sql】使用触发器

    今天在写sql触发器时遇到这样一个问题: 利用完整性规则创建教师表,包括(教师工号,姓名,性别,职称,工资),在此基础上定义触发器,为教师表Teacher定义完整性规则“教授的工资不能低于4000元, ...

  10. vue.js 源代码学习笔记 ----- 工具方法 option

    /* @flow */ import Vue from '../instance/index' import config from '../config' import { warn } from ...