A GeoSeries
is essentially a vector where each entry in the vector is a set of shapes corresponding to one observation. An entry may consist of only one shape (like a single polygon) or multiple shapes that are meant to be thought of as one observation (like the many polygons that make up the State of Hawaii or a country like Indonesia).
GeoSeries本质上是一个向量,向量中的每一个条目都是一组对应于一个观测值的形状。一个条目可能由一个形状组成(比如一个多边形面),也可能由多个形状组成(比如构成夏威夷州或印度尼西亚等国家和地区的若干多边形。)
geopandas has three basic classes of geometric objects (which are actually shapely objects):
geopandas具有如下三类基本的几何对象(实际上是shapely对象):
- Points / Multi-Points
- Lines / Multi-Lines
- Polygons / Multi-Polygons
Note that all entries in a GeoSeries
need not be of the same geometric type, although certain export operations will fail if this is not the case.
需要注意的是,GeoSeries所包含的条目不需要具有相同的几何类型,但是可能会导致一些操作失败。
Overview of Attributes and Methods(属性和方法)
The GeoSeries
class implements nearly all of the attributes and methods of Shapely objects. When applied to a GeoSeries
, they will apply elementwise to all geometries in the series. Binary operations can be applied between two GeoSeries
, in which case the operation is carried out elementwise. The two series will be aligned by matching indices. Binary operations can also be applied to a single geometry, in which case the operation is carried out for each element of the series with that geometry. In either case, a Series
or a GeoSeries
will be returned, as appropriate.
GeoSeries类实现了Shapely对象中几乎所有的属性和方法。当应用于 GeoSeries 时,会将按元素应用于所有几何图形。可以在两个 GeoSeries 之间应用二元操作,在这种情况下,操作是按元素执行的。这两个GeoSeries将通过匹配索引对齐。二元操作也可以应用于单个几何,在这种情况下,将对具有该几何的系列中的每个元素执行运算。在任何一种情况下,都会根据需要返回 Series 或 GeoSeries。
A short summary of a few attributes and methods for GeoSeries is presented here, and a full list can be found in the all attributes and methods page. There is also a family of methods for creating new shapes by expanding existing shapes or applying set-theoretic operations like “union” described in geometric manipulations.
此处简要介绍了 GeoSeries 的一些属性和方法,完整列表可在所有属性和方法页面中找到。还有一系列方法可以通过扩展现有形状或应用集合论操作(如几何操作中描述的“联合”)来创建新形状。
Attributes
area
: shape area (units of projection – see projections)。形状面积(投影单位——见投影)。bounds
: tuple of max and min coordinates on each axis for each shape。每个形状的每个轴上的最大和最小坐标组成的元组。total_bounds
: tuple of max and min coordinates on each axis for entire GeoSeries。整个 GeoSeries 每个轴上的最大和最小坐标组成的元组。geom_type
: type of geometry。几何类型。is_valid
: tests if coordinates make a shape that is reasonable geometric shape(according to this)。测试坐标是否构成合理的几何形状。
Basic Methods
distance()
: returnsSeries
with minimum distance from each entry toother
。计算最小距离。centroid
: returnsGeoSeries
of centroids。计算质心点。representative_point()
: returnsGeoSeries
of points that are guaranteed to be within each geometry. It does NOT return centroids。返回保证在每个几何图形中的点,不返回质心。to_crs()
: change coordinate reference system. See projections。改变坐标参考系。plot()
: plotGeoSeries
. See mapping。绘图。
Relationship Tests
geom_almost_equals()
: is shape almost the same asother
(good when floating point precision issues make shapes slightly different)。形状与其他形状几乎相同(浮点精度问题使形状略有不同时使用)。contains()
: is shape contained withinother
。形状包含在other
。intersects()
: does shape intersectother
。形状是否与other
相交。