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的更多相关文章
随机推荐
- maven项目Java resources 上面有个红叉但是代码里面并没有什么报错
maven项目Java resources 上面有个红叉但是代码里面并没有什么报错 解决办法: 1.通过: windows菜单 -> show view/other 菜单 -> o ...
- HDU 3506 (环形石子合并)区间dp+四边形优化
Monkey Party Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Tot ...
- underscore || lodash
1.http://www.css88.com/archives/5443 (underscore) let list = _.filter(record.orderGoodsList, item =& ...
- How to create Oracle ASM devices using device-mapper multipath devices in Red Hat Enterprise Linux 6
How to create Oracle ASM devices using device-mapper multipath devices in Red Hat Enterprise Linux 6 ...
- opencv:图像的基本变换
0.概述 图像变换的基本原理都是找到原图和目标图的像素位置的映射关系,这个可以用坐标系来思考,在opencv中, 图像的坐标系是从左上角开始(0,0),向右是x增加方向(cols),向下时y增加方向( ...
- LeetCode OJ:Longest Substring Without Repeating Characters(最长无重复字符子串)
Given a string, find the length of the longest substring without repeating characters. For example, ...
- 12.18 分布式系统下的session
广义的session: 会话控制,可以理解成为一种保存key-value的机制 从key的方面来看:sessionId和token sessionId: 服务端请求客户端的时候,服务端通过setcoo ...
- PostgreSQL 系统参数调整及并行设置(转)
转自:https://yq.aliyun.com/teams/5 OS 准备 # yum -y install coreutils glib2 lrzsz sysstat e4fsprogs xfsp ...
- Android SDK无法更新解决办法
一.设置SDK代理 启动Android SDK Manager,选择菜单 Tools ->Options -> 代理地址: mirrors.opencas.cn 代理端口: 80 如下图: ...
- ss-libev 源码解析udp篇 (4)
本篇分析remote_recv_cb,这是整个udp转发的反方向,即读取从后端发送过来的数据再发送给前端.对于ss-server,读取到的数据是目标地址的udp服务器发送回来的响应数据,ss-serv ...