GeoPandas 兼容性#

cuSpatial 支持 GeoPandas 支持的任何几何格式。从 GeoPandas.GeoSeriesGeoPandas.GeoDataFrame 加载几何信息。

>>> host_dataframe = geopandas.read_file(geopandas.datasets.get_path("naturalearth_lowres"))
    cugpdf = cuspatial.from_geopandas(host_dataframe)

>>> cugpdf = cuspatial.GeoDataFrame(gpdf)
class cuspatial.GeoDataFrame(data: Dict | GeoDataFrame | DataFrame = None)#

一个 GPU GeoDataFrame 对象。

方法

reset_index([level, drop, inplace, ...])

重置索引,或其一级。

to_geopandas([nullable])

从 cuspatial GeoDataFrame 中的坐标返回一个新的 GeoPandas GeoDataFrame 对象。

to_pandas([nullable])

调用 self.to_geopandas,将 GeoSeries 列转换为 GeoPandas 列,将 cudf.Series 列转换为 pandas.Series 列,并返回 pandas.DataFrame。

cummax

cummin

cumprod

cumsum

cummax(axis=None, *args, **kwargs)#

返回 IndexedFrame 的累积最大值。

参数:
axis: {index (0), columns(1)}

应用函数的轴。

skipna: bool, default True

排除 NA/null 值。如果整个行/列为 NA,结果将为 NA。

返回:
IndexedFrame

示例

Series

>>> import cudf
>>> ser = cudf.Series([1, 5, 2, 4, 3])
>>> ser.cumsum()
0    1
1    6
2    8
3    12
4    15

DataFrame

>>> import cudf
>>> df = cudf.DataFrame({'a': [1, 2, 3, 4], 'b': [7, 8, 9, 10]})
>>> s.cumsum()
    a   b
0   1   7
1   3  15
2   6  24
3  10  34
cummin(axis=None, *args, **kwargs)#

返回 IndexedFrame 的累积最小值。

参数:
axis: {index (0), columns(1)}

应用函数的轴。

skipna: bool, default True

排除 NA/null 值。如果整个行/列为 NA,结果将为 NA。

返回:
IndexedFrame

示例

Series

>>> import cudf
>>> ser = cudf.Series([1, 5, 2, 4, 3])
>>> ser.cumsum()
0    1
1    6
2    8
3    12
4    15

DataFrame

>>> import cudf
>>> df = cudf.DataFrame({'a': [1, 2, 3, 4], 'b': [7, 8, 9, 10]})
>>> s.cumsum()
    a   b
0   1   7
1   3  15
2   6  24
3  10  34
cumprod(axis=None, *args, **kwargs)#

返回 IndexedFrame 的累积乘积。

参数:
axis: {index (0), columns(1)}

应用函数的轴。

skipna: bool, default True

排除 NA/null 值。如果整个行/列为 NA,结果将为 NA。

返回:
IndexedFrame

示例

Series

>>> import cudf
>>> ser = cudf.Series([1, 5, 2, 4, 3])
>>> ser.cumsum()
0    1
1    6
2    8
3    12
4    15

DataFrame

>>> import cudf
>>> df = cudf.DataFrame({'a': [1, 2, 3, 4], 'b': [7, 8, 9, 10]})
>>> s.cumsum()
    a   b
0   1   7
1   3  15
2   6  24
3  10  34
cumsum(axis=None, *args, **kwargs)#

返回 IndexedFrame 的累积总和。

参数:
axis: {index (0), columns(1)}

应用函数的轴。

skipna: bool, default True

排除 NA/null 值。如果整个行/列为 NA,结果将为 NA。

返回:
IndexedFrame

示例

Series

>>> import cudf
>>> ser = cudf.Series([1, 5, 2, 4, 3])
>>> ser.cumsum()
0    1
1    6
2    8
3    12
4    15

DataFrame

>>> import cudf
>>> df = cudf.DataFrame({'a': [1, 2, 3, 4], 'b': [7, 8, 9, 10]})
>>> s.cumsum()
    a   b
0   1   7
1   3  15
2   6  24
3  10  34
reset_index(level=None, drop=False, inplace=False, col_level=0, col_fill='')#

重置索引,或其一级。

参数:
levelint, str, tuple, 或 list, 默认 None

只从索引中移除给定的级别。默认移除所有级别。

dropbool, 默认 False

不尝试将索引插入到 dataframe 列中。这将索引重置为默认的整数索引。

inplacebool, 默认 False

就地修改 GeoDataFrame(不创建新对象)。

col_levelintstr, 默认 0

如果列有多个级别,确定将标签插入哪个级别。默认插入到第一个级别。

col_fillobject, 默认 “”

如果列有多个级别,确定其他级别如何命名。如果为 None,则重复索引名称。

返回:
GeoDataFrame
to_geopandas(nullable=False)#

从 cuspatial GeoDataFrame 中的坐标返回一个新的 GeoPandas GeoDataFrame 对象。

参数:
nullable: 与 cudf `to_pandas` 签名匹配,尚未支持。
to_pandas(nullable=False)#

调用 self.to_geopandas,将 GeoSeries 列转换为 GeoPandas 列,将 cudf.Series 列转换为 pandas.Series 列,并返回 pandas.DataFrame。

参数:
nullable: 与 cudf `to_pandas` 签名匹配,尚未支持。
class cuspatial.GeoSeries(data: GeoSeries | Tuple | T | Series | GeoColumn | list | None, index: Index | Index | None = None, dtype=None, name=None, nan_as_null=True)#

cuspatial.GeoSeries 支持 GPU 支持的 shapely-like 对象的存储和计算。我们的目标是与 GeoPandas 实现功能对等。目前,只直接支持 from_geopandas 和 to_geopandas。cuspatial GIS、索引和轨迹函数依赖于存储在 GeoArrowBuffers 对象中的数组,可以通过 pointsmultipointslinespolygons 访问器进行访问。

属性:
column_type

用于确定 GeoColumn 的类型。

feature_types
iloc

返回 GeoSeries 的第 i 行。

lines

访问底层 GeoArrowBuffersLineArray

loc

目前不支持。

multipoints

访问底层 GeoArrowBuffersMultiPointArray

point_indices
points

访问底层 GeoArrowBuffersPointsArray

polygons

访问底层 GeoArrowBuffersPolygonArray

sizes

返回 GeoSeries 中每个几何对象的点数。

type

方法

GeoSeriesILocIndexer(sr)

GeoSeries 的每一行是六种类型之一:Point, MultiPoint, LineString, MultiLineString, Polygon, 或 MultiPolygon。

GeoSeriesLocIndexer(_sr)

将索引映射到整数 Series 并使用它。

align(other)

使用外部连接对两个 GeoSeries 的行进行对齐。

contains(other[, align, allpairs, mode])

返回一个 Series 对象,其 dtypedtype('bool'),对于包含 _other_ 的每个对齐几何对象,其值为 True

contains_properly(other[, align, allpairs, mode])

返回一个 Series 对象,其 dtypedtype('bool'),对于包含 _other_ 的每个对齐几何对象,其值为 True

covers(other[, align])

计算 GeoSeries 特征 A 是否覆盖 GeoSeries 特征 B。

crosses(other[, align])

对于与 other 相交的所有对齐几何对象,返回 True,否则返回 False。

disjoint(other[, align])

对于与 other 不相交的所有对齐几何对象,返回 True,否则返回 False。

distance(other[, align])

返回一个 Series,其中包含到对齐的其他对象的距离。

from_arrow()

从 PyArrow Array/ChunkedArray 创建。

from_linestrings_xy(linestrings_xy, ...)

从交错的 xy 坐标数组构造一个 MULTILINESTRINGs 的 GeoSeries。

from_multipoints_xy(multipoints_xy, ...)

从交错的 xy 坐标数组构造一个 MULTIPOINTs 的 GeoSeries。

from_points_xy(points_xy)

从交错的 xy 坐标数组构造一个 POINTs 的 GeoSeries。

from_polygons_xy(polygons_xy, ring_offset, ...)

从交错的 xy 坐标数组构造一个 MULTIPOLYGONs 的 GeoSeries。

geom_equals(other[, align])

计算 GeoSeries 特征 A 是否等于 GeoSeries 特征 B。

intersects(other[, align])

返回一个 Series 对象,其 dtypedtype('bool'),对于与 _other_ 相交的每个对齐几何对象,其值为 True

isna()

检测缺失值。

notna()

检测非缺失值。

overlaps(other[, align])

对于与 other 重叠的所有对齐几何对象,返回 True,否则返回 False。

reset_index([level, drop, name, inplace])

重置 GeoSeries 的索引。

to_arrow()

转换为 GeoArrow Array。

to_geopandas([nullable])

从 cuspatial GeoSeries 中的坐标返回一个新的 GeoPandas GeoSeries 对象。

to_pandas()

将 to_pandas 和 to_geopandas 视为相同的调用,这提高了与 pandas 的兼容性。

touches(other[, align])

对于接触 other 的所有对齐几何对象,返回 True,否则返回 False。

within(other[, align])

返回一个 Series 对象,其 dtypedtype('bool'),对于在 _other_ 内的每个对齐几何对象,其值为 True

GeoColumnAccessor

LineStringGeoColumnAccessor

MultiPointGeoColumnAccessor

PolygonGeoColumnAccessor

to_shapely

示例

>>> from shapely.geometry import Point
    import geopandas
    import cuspatial
    cuseries = cuspatial.GeoSeries(geopandas.GeoSeries(Point(-1, 0)))
    cuseries.points.xy
    0   -1.0
    1    0.0
    dtype: float64
class GeoSeriesILocIndexer(sr)#

GeoSeries 的每一行是六种类型之一:Point, MultiPoint, LineString, MultiLineString, Polygon, 或 MultiPolygon。

class GeoSeriesLocIndexer(_sr)#

将索引映射到整数 Series 并使用它。

align(other)#

使用外部连接对两个 GeoSeries 的行进行对齐。

align 重新排列两个 GeoSeries,使其索引匹配。如果一个 GeoSeries 比另一个长,短的 GeoSeries 将增加长度,并添加缺失的索引值,在创建空行时插入 None

对齐包括匹配索引的长度,对它们进行排序,并将左侧 GeoSeries 中存在的额外索引值插入到右侧 GeoSeries 中。

参数:
other: GeoSeries
返回:
(left, right)GeoSeries

一对对齐的 GeoSeries

示例

>>> points = gpd.GeoSeries([
    Point((-8, -8)),
    Point((-2, -2)),
])
>>> point = gpd.GeoSeries(points[0])
>>> print(points.align(point))

(0 POINT (-8.00000 -8.00000) 1 POINT (-2.00000 -2.00000) dtype: geometry, 0 POINT (-8.00000 -8.00000) 1 None dtype: geometry)

>>> points_right = gpd.GeoSeries([
    Point((-2, -2)),
    Point((-8, -8)),
], index=[1,0])
>>> print(points.align(points_right))

(0 POINT (-8.00000 -8.00000) 1 POINT (-2.00000 -2.00000) dtype: geometry, 0 POINT (-8.00000 -8.00000) 1 POINT (-2.00000 -2.00000) dtype: geometry)

>>> points_alpha = gpd.GeoSeries([
    Point((-1, 1)),
    Point((1, -1)),
], index=['a', 'b'])
>>> print(points.align(points_alpha))

(0 POINT (-8.00000 -8.00000) 1 POINT (-2.00000 -2.00000) a None b None dtype: geometry, 0 None 1 None a POINT (-1.00000 1.00000) b POINT (1.00000 -1.00000) dtype: geometry)

property column_type#

用于确定 GeoColumn 的类型。这是一个返回值方法,产生与各种 contains_only_* 方法相同的结果,只是作为一个枚举(Enum)而不是许多布尔值。

contains(other, align=False, allpairs=False, mode='full')#

返回一个 Series 对象,其 dtypedtype(‘bool’),对于包含 _other_ 的每个对齐几何对象,其值为 True

如果 b 的边界和内部都在 a 的内部,并且 b 的任何点都不在 a 的外部,则称对象 a 包含 b。

如果 allpairs=False,结果将是一个 Series 对象,其 dtypedtype(‘bool’)。如果 allpairs=True,结果将是一个 DataFrame,包含两列:point_indicespolygon_indices,每列都是一个 Series 对象,其 dtypedtype(‘int32’)point_indices Series 包含右侧 GeoSeries 中点的索引,polygon_indices Series 包含左侧 GeoSeries 中多边形的索引。排除边界点。

参数:
otherGeoSeries
alignbool, 默认 False

如果为 True,则在执行操作之前对两个 GeoSeries 进行对齐。如果为 False,则在未对齐的 GeoSeries 上执行操作。

allpairsbool, 默认 False

如果为 True,结果将是一个 DataFrame,包含两列:point_indicespolygon_indices,每列都是一个 Series 对象,其 dtypedtype(‘int32’)point_indices Series 包含右侧 GeoSeries 中点的索引,polygon_indices Series 包含左侧 GeoSeries 中多边形的索引。排除包含 A 边界中点的几何对象。

modestr, 默认 “full” 或 “basic_none”, “basic_any”,

“basic_all” 或 “basic_count”。如果为 “full”,结果将是一个 Series 对象,其 dtypedtype(‘bool’),对于包含 _other_ 的每个对齐几何对象,其值为 True。如果为 “intersects”,结果将是一个 Series 对象,其 dtypedtype(‘bool’),对于包含 _other_ 或与 _other_ 相交的每个对齐几何对象,其值为 True

返回:
Series 或 DataFrame

一个 Series 对象,其 dtypedtype(‘bool’),对于包含 _other_ 的每个对齐几何对象,其值为 True。如果 allpairs=True,结果将是一个 DataFrame,包含两列:point_indicespolygon_indices,每列都是一个 Series 对象,其 dtypedtype(‘int32’)

注意事项

allpairs=True 排除包含 A 边界中点的几何对象。

contains_properly(other, align=False, allpairs=False, mode='full')#

返回一个 Series 对象,其 dtypedtype(‘bool’),对于包含 _other_ 的每个对齐几何对象,其值为 True

从 GeoSeries 点和 GeoSeries 多边形计算哪些点被对应的多边形适当包含。如果点 B 与多边形 A 的内部相交但不与边界(或外部)相交,则多边形 A 适当包含点 B。

如果 allpairs=False,结果将是一个 Series 对象,其 dtypedtype(‘bool’)。如果 allpairs=True,结果将是一个 DataFrame,包含两列:point_indicespolygon_indices,每列都是一个 Series 对象,其 dtypedtype(‘int32’)point_indices Series 包含右侧 GeoSeries 中点的索引,polygon_indices Series 包含左侧 GeoSeries 中多边形的索引。

参数:
other

一个 cuspatial.GeoSeries

align=True

在计算 .contains 之前是否对齐索引。如果索引未对齐,将根据其隐式行顺序进行比较。

allpairs=False

True 计算两个 GeoSeries 之间所有几何对象对的 contains。False 计算左侧 GeoSeries 中每个几何对象与右侧 GeoSeries 中相应几何对象的 contains。默认为 False。

返回:
resultcudf.Series 或 cudf.DataFrame

allpairs=False 的情况下,返回一个布尔值 Series,指示每个点是否落在输入中对应的多边形内。在 allpairs=True 的情况下,返回一个包含两列的 DataFrame:point_indicespolygon_indices,每列都是一个 Series 对象,其 dtypedtype(‘int32’)

示例

测试一个多边形是否在另一个多边形内

>>> point = cuspatial.GeoSeries([Point(0.5, 0.5)])
>>> polygon = cuspatial.GeoSeries([
>>>     Polygon([[0, 0], [1, 0], [1, 1], [0, 0]]),
>>> ])
>>> print(polygon.contains(point))
0    False
dtype: bool

测试三个点是否落入两个多边形中的任意一个内 >>> point = cuspatial.GeoSeries([ >>> Point(0, 0), >>> Point(-1, 0), >>> Point(-2, 0), >>> Point(0, 0), >>> Point(-1, 0), >>> Point(-2, 0), >>> ]) >>> polygon = cuspatial.GeoSeries([ >>> Polygon([[0, 0], [1, 0], [1, 1], [0, 0]]), >>> Polygon([[0, 0], [1, 0], [1, 1], [0, 0]]), >>> Polygon([[0, 0], [1, 0], [1, 1], [0, 0]]), >>> Polygon([[-2, -2], [-2, 2], [2, 2], [-2, -2]]), >>> Polygon([[-2, -2], [-2, 2], [2, 2], [-2, -2]]), >>> Polygon([[-2, -2], [-2, 2], [2, 2], [-2, -2]]), >>> ]) >>> print(polygon.contains(point)) 0 False 1 True 2 False 3 False 4 True 5 False dtype: bool

使用 allpairs 模式测试三个点是否落入两个多边形中的任意一个内: >>> point = cuspatial.GeoSeries([ >>> Point(0, 0), >>> Point(-1, 0), >>> Point(-2, 0), >>> ]) >>> polygon = cuspatial.GeoSeries([ >>> Polygon([[0, 0], [1, 0], [1, 1], [0, 0]]), >>> Polygon([[-2, -2], [-2, 2], [2, 2], [-2, -2]]), >>> ]) >>> print(polygon.contains(point, allpairs=True)) index point_indices polygon_indices 0 2 1

covers(other, align=True)#

计算 GeoSeries 特征 A 是否覆盖 GeoSeries 特征 B。如果 B 上没有任何点位于 A 的外部,则 A 覆盖 B。

参数:
other

一个 cuspatial.GeoSeries

align=True

在调用 binpred 之前对齐 GeoSeries 索引

返回:
resultcudf.Series

一个布尔值 Series,指示输入 GeoSeries 中的每个特征是否覆盖 other GeoSeries 中的相应特征。

crosses(other, align=True)#

对于与 other 相交的所有对齐几何对象,返回 True,否则返回 False。

如果几何对象共享一些但非全部内部点,具有相同的维度,并且几何对象内部的交集具有与几何对象本身维度减一的维度,则几何对象相交。

参数:
other

一个 cuspatial.GeoSeries

align=True

在调用 binpred 之前对齐 GeoSeries 索引

返回:
resultcudf.Series

一个布尔值 Series,指示每个几何对象是否与输入中的相应几何对象相交。

disjoint(other, align=True)#

对于与 other 不相交的所有对齐几何对象,返回 True,否则返回 False。

如果一个对象的边界和内部与 other 的边界和内部完全不相交,则称该对象与 other 不相交。

参数:
other

一个 cuspatial.GeoSeries

align=True

在调用 binpred 之前对齐 GeoSeries 索引

返回:
resultcudf.Series

一个布尔值 Series,指示每对相应的几何对象是否不相交。

distance(other, align=True)#

返回一个 Series,其中包含到对齐的其他对象的距离。

该操作以一对一的行方式进行。有关详细信息,请参阅 geopandas.GeoSeries.distance 文档。

参数:
other

要查找距离的 GeoSeries(元素级)或几何对象。

alignbool, 默认 True

如果为 True,则根据索引自动对齐 GeoSeries。如果为 False,则保留元素的顺序。

返回:
Series (float)

注意事项

与 GeoPandas 不同,此 API 目前仅支持仅包含单一类型几何对象的 geoseries。

示例

>>> from shapely.geometry import Point
>>> point = GeoSeries([Point(0, 0)])
>>> point2 = GeoSeries([Point(1, 1)])
>>> print(point.distance(point2))
0    1.414214
dtype: float64

默认情况下,在计算之前会先对 geoseries 进行对齐

>>> from shapely.geometry import Point
>>> point = GeoSeries([Point(0, 0)])
>>> point2 = GeoSeries([Point(1, 1), Point(2, 2)])
>>> print(point.distance(point2))
0    1.414214
1         NaN
dtype: float64

这可以通过设置 align=False 来覆盖

>>> lines = GeoSeries([
        LineString([(0, 0), (1, 1)]), LineString([(2, 2), (3, 3)])])
>>> polys = GeoSeries([
        Polygon([(0, 0), (1, 1), (1, 0)]),
        Polygon([(2, 2), (3, 3), (3, 2)])],
        index=[1, 0])
>>> lines.distance(polys), align=False)
0    0.0
1    0.0
dtype: float64
>>> lines.distance(polys, align=True)
0    1.414214
1    1.414214
dtype: float64
from_arrow()#

从 PyArrow Array/ChunkedArray 创建。

参数:
arrayPyArrow Array/ChunkedArray

需要转换的 PyArrow 对象。

返回:
SingleColumnFrame
引发:
输入类型无效时引发 TypeError。

示例

>>> import cudf
>>> import pyarrow as pa
>>> cudf.Series.from_arrow(pa.array(["a", "b", None]))
0       a
1       b
2    <NA>
dtype: object
classmethod from_linestrings_xy(linestrings_xy, part_offset, geometry_offset) T#

从交错的 xy 坐标数组构造一个 MULTILINESTRINGs 的 GeoSeries。

参数:
linestrings_xyarray-like

linestring 的坐标,解释为交错的 x-y 坐标。

geometry_offsetarray-like

每个几何对象第一个坐标的偏移量。此数组的长度是几何对象的数量。偏移量差大于 1 表示 MultiLinestring。

part_offsetarray-like

coordinates 数组中表示每个部分的开始的偏移量。此数组的长度是部分的数量。

返回:
GeoSeries

一个 MULTILINESTRINGs 的 GeoSeries。

classmethod from_multipoints_xy(multipoints_xy, geometry_offset)#

从交错的 xy 坐标数组构造一个 MULTIPOINTs 的 GeoSeries。

参数:
multipoints_xy: array-like

multipoints 的坐标,解释为交错的 x-y 坐标。

geometry_offset: array-like

表示 multipoint 起始索引的偏移量。索引乘以 2 得到坐标的起始索引。详情请参见示例。

返回:
GeoSeries

一个由点组成的 GeoSeries。

classmethod from_points_xy(points_xy)#

从交错的 xy 坐标数组构造一个 POINTs 的 GeoSeries。

参数:
points_xy: array-like

点的坐标,解释为交错的 x-y 坐标。

返回:
GeoSeries

一个由点组成的 GeoSeries。

classmethod from_polygons_xy(polygons_xy, ring_offset, part_offset, geometry_offset) T#

从交错的 xy 坐标数组构造一个 MULTIPOLYGONs 的 GeoSeries。

参数:
polygons_xyarray-like

点的坐标,解释为交错的 x-y 坐标。

ring_offsetarray-like

part 数组中表示每个环的开始的偏移量。此数组的长度是环的数量。

part_offsetarray-like

coordinates 数组中表示每个部分的开始的偏移量。此数组的长度是部分的数量。

geometry_offsetarray-like

每个几何对象第一个坐标的偏移量。此数组的长度是几何对象的数量。偏移量差大于 1 表示 MultiLinestring。

返回:
GeoSeries

一个 MULTIPOLYGONs 的 GeoSeries。

geom_equals(other, align=True)#

计算 GeoSeries 特征 A 是否等于 GeoSeries 特征 B。如果它们的顶点相等,则特征相等。

如果一个对象的集合论边界、内部和外部与另一个对象一致,则该对象与 other 相等。

参数:
other

一个 cuspatial.GeoSeries

align=True

在计算 .contains 之前是否对齐索引。如果索引未对齐,将根据其隐式行顺序进行比较。

返回:
resultcudf.Series

一个布尔值 Series,指示 A 中的每个特征是否等于 B 中的相应特征。

示例

测试两个点是否相等: >>> point = cuspatial.GeoSeries([Point(0, 0)]) >>> point2 = cuspatial.GeoSeries([Point(0, 0)]) >>> print(point.geom_equals(point2)) 0 True dtype: bool

测试两个多边形是否相等: >>> polygon = cuspatial.GeoSeries([ >>> Polygon([[0, 0], [1, 0], [1, 1], [0, 0]]), >>> ]) >>> polygon2 = cuspatial.GeoSeries([ >>> Polygon([[0, 0], [1, 0], [1, 1], [0, 0]]), >>> ]) >>> print(polygon.geom_equals(polygon2)) 0 True dtype: bool

property iloc#

返回 GeoSeries 的第 i 行。

intersects(other, align=True)#

返回一个 Series 对象,其 dtypedtype(‘bool’),对于与 _other_ 相交的每个对齐几何对象,其值为 True

如果一个对象的 _边界_ 和 _内部_ 与 other 的边界和内部以任何方式相交,则称该对象与 _other_ 相交。

参数:
other

一个 cuspatial.GeoSeries

align=True

在调用 binpred 之前对齐 GeoSeries 索引

返回:
resultcudf.Series

一个布尔值 Series,指示每行的几何对象是否相交。

isna()#

检测缺失值。

property lines#

访问底层 GeoArrowBuffersLineArray

property loc#

目前不支持。

property multipoints#

访问底层 GeoArrowBuffersMultiPointArray

notna()#

检测非缺失值。

overlaps(other, align=True)#

对于与 other 重叠的所有对齐几何对象,返回 True,否则返回 False。

如果几何对象共享多个但非全部点,具有相同的维度,并且几何对象内部的交集具有与几何对象本身相同的维度,则几何对象重叠。

参数:
other

一个 cuspatial.GeoSeries

align=True

在调用 binpred 之前对齐 GeoSeries 索引

返回:
resultcudf.Series

一个布尔值 Series,指示每个几何对象是否与输入中的相应几何对象重叠。

property points#

访问底层 GeoArrowBuffersPointsArray

property polygons#

访问底层 GeoArrowBuffersPolygonArray

reset_index(level=None, drop=False, name=None, inplace=False)#

重置 GeoSeries 的索引。

参数:
levelint, str, tuple, 或 list, 默认 None

只从索引中移除给定的级别。默认移除所有级别。

dropbool, 默认 False

如果 drop 为 False,创建一个新的 dataframe,其中原始索引作为一个列。如果 drop 为 True,则原始索引被丢弃。

nameobject, 可选

用于包含原始 Series 值的列的名称。

inplace: bool, 默认 False

如果为 True,则修改原始 GeoSeries。

返回:
GeoSeries

重置索引后的 GeoSeries。

示例

>>> points = gpd.GeoSeries([
    Point((-8, -8)),
    Point((-2, -2)),
], index=[1, 0])
>>> print(points.reset_index())

0 POINT (-8.00000 -8.00000) 1 POINT (-2.00000 -2.00000) dtype: geometry

property sizes#

返回 GeoSeries 中每个几何对象的点数。

返回:
sizescudf.Series

GeoSeries 中每个几何对象的大小。

注意事项

几何对象的大小是它包含的点数。多边形的大小是其所有环中的总点数。多重多边形的大小是其所有多边形大小的总和。线串的大小是其单行中的点数。多重线串的大小是其所有线串大小的总和。多点的大小是其单个点中的点数。点的大小是 1。

to_arrow()#

转换为 GeoArrow Array。

返回:
result: 包含 GeoArrow Arrays 的 GeoArrow Union

示例

>>> from shapely.geometry import MultiLineString, LineString
>>> cugpdf = cuspatial.from_geopandas(geopandas.GeoSeries(
    MultiLineString(
        [
            [(1, 0), (0, 1)],
            [(0, 0), (1, 1)]
        ]
    )))
>>> cugpdf.to_arrow()
<pyarrow.lib.UnionArray object at 0x7f7061c0e0a0>
-- is_valid: all not null
-- type_ids:   [
    2
  ]
-- value_offsets:   [
    0
  ]
-- child 0 type: list<item: null>
  []
-- child 1 type: list<item: null>
  []
-- child 2 type: list<item: list<item: list<item: double>>>
  [
    [
      [
        [
          1,
          0
        ],
        [
          0,
          1
        ]
      ],
      [
        [
          0,
          0
        ],
        [
          1,
          1
        ]
      ]
    ]
  ]
-- child 3 type: list<item: null>
  []
to_geopandas(nullable=False)#

从 cuspatial GeoSeries 中的坐标返回一个新的 GeoPandas GeoSeries 对象。

to_pandas()#

将 to_pandas 和 to_geopandas 视为相同的调用,这提高了与 pandas 的兼容性。

touches(other, align=True)#

对于接触 other 的所有对齐几何对象,返回 True,否则返回 False。

如果几何对象共享任何重合的边或共享任何顶点,并且它们的内部不相交,则几何对象接触。

参数:
other

一个 cuspatial.GeoSeries

align=True

在调用 binpred 之前对齐 GeoSeries 索引

返回:
resultcudf.Series

一个布尔值 Series,指示每个几何对象是否接触输入中的相应几何对象。

within(other, align=True)#

返回一个 Series 对象,其 dtypedtype(‘bool’),对于在 _other_ 内的每个对齐几何对象,其值为 True

如果一个对象至少有一个点位于 other 的内部且没有点位于 other 的外部,则称该对象位于 other 内。

参数:
other

一个 cuspatial.GeoSeries

align=True

在调用 binpred 之前对齐 GeoSeries 索引

返回:
resultcudf.Series

一个布尔值 Series,指示每个特征是否落在输入中对应的多边形内。