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的更多相关文章
随机推荐
- ContentPresenter元素
一个内容控件 分解它的“结构树”,肯定能够看到ContentPresenter“元素”,该元素的功能:用来为“内容控件”显示“Content”
- buctoj——合法的出栈顺序
题目描述 我们知道,一个入栈序列是{1,2,3}的合法出栈序列有{3,2,1},{1,2,3}等,而{3,1,2}是不合法的.现在冰语有一个长度为n的序列A(保证序列内数字唯一,且1<=A[i] ...
- springboo 添加logback日志
springboot默认引入logback相关的jar包 1.在 Application.properties里添加 logging.config=classpath:logback-spring.x ...
- jquery过滤特殊字符及js字符串转为数字
//替换特殊字符 $(this).val($(this).val().replace(/[~'!<>@#$%^&*()-+_=:]/g, "")); 方法主要有 ...
- vue-parcel打包入门
what 快速,零配置的 Web 应用程序打包器 why 快捷,配置比较少 使用 Parcel 打包的 vue HelloWorld 应用.GitHub 地址: https://github.com/ ...
- vue--踩坑
1.通过computed计算属性,计算过的值,假如传递给子组件,在子组件中修改是不起作用的.
- [置顶]
kubernetes1.8发布跟踪
一.Kubernetes发布历史回顾 1. Kubernetes 1.0 - 2015年7月发布 2. Kubernetes 1.1 - 2015年11月发布 3. ...
- Java并发编程之CountDownLatch,CyclicBarrier实现一组线程相互等待、唤醒
java多线程应用场景不少,有时自己编写代码又不太容易实现,好在concurrent包提供了不少实现类,还有google的guava包更是提供了一些最佳实践,这让我们在面对一些多线程的场景时,有了不少 ...
- ExtJS小技巧
一.从form中获取field的三个方法: 1.Ext.getCmp('id'); 2.FormPanel.getForm().findField('id/name'); 3.Ext.get('id/ ...
- C++语言的url encode 和decode
std::string UrlEncode(const std::string& szToEncode) { std::string src = szToEncode; char hex[] ...