pyqtree
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)
- Index
- pyqtree._QuadTree
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
Example 1
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 |
Example 2
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的更多相关文章
随机推荐
- [spring]<context:property-placeholder/>
问题: 有些参数在某些阶段中是常量,这些参数在不同阶段之间又往往需要改变,如: 在开发阶段我们连接数据库时的url,username,password等信息 分布式应用中client端的server地 ...
- javascript中的定时器
本文地址:[http://www.xiabingbao.com/javascript/2015/04/20/javascript-timer/] 在以前的文章[javascript中的定时器]中,简单 ...
- flask学习(十):模板中访问模型和字典的属性
访问模型中的属性或者是字典,可以通过{{params.property}}的形式,或者是使用{{params['age']}}这样的形式
- 我的 VSCode 常用扩展
Beautify (option+shift+F) Bookmarks (option+option+k,l,j) Debugger for Chrome Docker EditorConfig fo ...
- Python 字典的一键多值,即一个键对应多个值
转自:http://blog.csdn.net/houyj1986/article/details/22624981 #encoding=utf-8 print '中国' #字典的一键多值 print ...
- fis 前端构建工具
1.http://fis.baidu.com/ (前端构建工具)
- opencv图像处理
#coding=utf-8 import cv2 import numpy as np img1 = cv2.imread("3.jpg") img2 = cv2.imread(& ...
- proxy-target-class 作用
该属性值默认为false,表示使用JDK动态代理织入增强;当值为true时,表示使用CGLib动态代理织入增强;但是,即使设置为false,如果目标类没有生命接口, 则Spring将自动使用CGLib ...
- Repeat a string repeat a string
重要的事情说3遍! 重复一个指定的字符串 num次,如果num是一个负数则返回一个空字符串. 这是一些对你有帮助的资源: Global String Object 这道题的思路就是按照题目要求一步一步 ...
- LeetCode OJ:Reorder List(重序链表)
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do thi ...