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的更多相关文章
随机推荐
- windows系统下,安装多个版本的jdk,java -version
问题描述: 开始安装了 jdk8 后来装了jdk9,可以为项目配置不同的jdk,相安无事: 今天发现软件需要jdk8的环境,结果我的java -version始终是jdk9.0.1: 解决办法:使ja ...
- IDEA的Tomcat配置Web的项目创建以及Servlet简单运行。
相关软件: 1.IDEA编译器 2.JDK 3.Tomcat (相关软件都可以到官网上下载,老表提示:不要下载最新版本因为不要做试验品) IDEA的安装非常简单,找好安装的盘,n ...
- Zookeeper在 Linux 系统的安装
安装步骤:第一步:安装 jdk第二步:把 zookeeper 的压缩包上传到 linux 系统.Alt+P 进入 SFTP ,输入 put d:\zookeeper-3.4.6.tar.gz 上传第三 ...
- spoj-ASSIGN-bitDP
ASSIGN - Assignments #dynamic-programming Problem Your task will be to calculate number of different ...
- msys git 安装配置、git命令行使用
安装 .安装msys git客户端程序 .打开git bash,命令ssh-keygen –C “admin@test.cn “ –t rsa .复制C:\Users\felix\.ssh\id_rs ...
- js排序算法01——冒泡排序
在codewars上面刷题卡住刷不下去了,意识到自己算法方面的不足,准备写一些算法方面的文章,此为一. 冒泡排序是很常见简单的算法了,每次比较任何两个相邻的项,如果第一个比第二个大,则交换他们,就像气 ...
- angular2 post以“application/x-www-form-urlencoded”形式传参的解决办法
angular2 post以“application/x-www-form-urlencoded”形式传参的解决办法 http://blog.csdn.net/tianjun2012/article/ ...
- 重温MVC基础入门
重温MVC基础入门 简介 本文主要是作者回顾MVC基础的文章,整合个人认为基础且重点的信息,通过简单实践进行复习. 相关代码地址:https://github.com/OtherRuan/Revi ...
- C#学习历程(七)[基础知识]
---恢复内容开始--- >>接受用户输入的整数 Console.readline():接受键盘输入的字符串,如果需要接受整数并输出,则需要字符串的转换. 一般建议使用Covert类中的方 ...
- zoj 2976 Light Bulbs(暴力枚举)
Light Bulbs Time Limit: 2 Seconds Memory Limit: 65536 KB Wildleopard had fallen in love with hi ...