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的更多相关文章
随机推荐
- LeetCode 275. H-Index II
275. H-Index II Add to List Description Submission Solutions Total Accepted: 42241 Total Submissions ...
- cowsay
# apt install cowsay sl cmatrix $ cowsay "hello~" $ find /usr/share/cowsay/cows -iname &qu ...
- HDU1595-最短路-删边
find the longest of the shortest Time Limit: 1000/5000 MS (Java/Others) Memory Limit: 32768/32768 ...
- SPOJ-394-ACODE - Alphacode / dp
ACODE - Alphacode #dynamic-programming Alice and Bob need to send secret messages to each other and ...
- Poj 1651 Multiplication Puzzle(区间dp)
Multiplication Puzzle Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10010 Accepted: ...
- 老鼠走迷宫(1)输出唯一路径(C语言)
需求 有一个迷宫,在迷宫的某个出口放着一块奶酪.将一只老鼠由某个入口处放进去,它必须穿过迷宫,找到奶酪.请找出它的行走路径. STEP 1 题目转化 我们用一个二维数组来表示迷宫,用2表示迷宫的墙壁, ...
- SpringInAction-- 配置Profile Bean
Profile Bean 使用场景描述: 在开发软件的时候,在数据库方面,往往不是一个库就能解决的,一般分为开发库.测试库.生产库,在这些库设置链接的时候,也会配置其对应的数据. 现有一种方式,就是单 ...
- flash cc新建swc文件
- vue-keep-alive
查看github源代码 https://github.com/Diamondjcx/vue-test Vue keep-alive实践总结 <keep-alive>是Vue的内置 ...
- Web访问控制
最近某婚介公司的实习生赵大胖的领导姚无发给赵大胖安排了一个任务: 给网站加上访问控制,游客不能访问看到美女的资料,只有注册的会员才能浏览. 赵大胖一时没有很好的思路,然后找到了研发组大佬老郑头. 老郑 ...