1. 主页
  2. 文档
  3. GeoPandas 0.12.2中文文档
  4. API reference
  5. Spatial index

Spatial index

GeoPandas offers built-in support for spatial indexing using an R-Tree algorithm. Depending on the ability to import pygeos, GeoPandas will either use pygeos.STRtree or rtree.index.Index. The main interface for both is the same and follows the pygeos model.

GeoPandas 使用 R-Tree 算法为空间索引提供内置支持。根据导入 pygeos 的能力,GeoPandas 将使用 pygeos.STRtree 或 rtree.index.Index。两者的主界面相同并遵循 pygeos 模型。

GeoSeries.sindex creates a spatial index, which can use the methods and properties documented below.

GeoSeries.sindex 创建一个空间索引,它可以使用下面记录的方法和属性。

Constructor

GeoSeries.sindexGenerate the spatial index

Spatial Index object

The spatial index object returned from GeoSeries.sindex has the following methods:

intersection(coordinates, *args, **kwargs)Compatibility wrapper for rtree.index.Index.intersection, use query instead.
is_emptyCheck if the spatial index is empty
nearest(*args, **kwargs)Return the nearest geometry in the tree for each input geometry in geometry.
query(geometry[, predicate, sort])Return the index of all geometries in the tree with extents that intersect the envelope of the input geometry.
query_bulk(geometry[, predicate, sort])Returns all combinations of each input geometry and geometries in the tree where the envelope of each input geometry intersects with the envelope of a tree geometry.
sizeSize of the spatial index
valid_query_predicatesReturns valid predicates for this spatial index.

The concrete implementations currently available are geopandas.sindex.PyGEOSSTRTreeIndex and geopandas.sindex.RTreeIndex.

In addition to the methods listed above, the rtree-based spatial index (geopandas.sindex.RTreeIndex) offers the full capability of rtree.index.Index – see the full API in the rtree documentation.

Similarly, the pygeos-based spatial index (geopandas.sindex.PyGEOSSTRTreeIndex) offers the full capability of pygeos.STRtree, including nearest-neighbor queries. See the full API in the PyGEOS STRTree documentation.

标签 , ,
这篇文章对您有用吗?

我们要如何帮助您?

欢迎留下您的宝贵建议

Please enter your comment!
Please enter your name here