GeoPandas Compatibility#

cuSpatial supports any geometry format supported by GeoPandas. Load geometry information from a GeoPandas.GeoSeries or GeoPandas.GeoDataFrame.

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

or

>>> cugpdf = cuspatial.GeoDataFrame(gpdf)
class cuspatial.GeoDataFrame(data: Union[Dict, GeoDataFrame, DataFrame] = None)#

A GPU GeoDataFrame object.

Methods

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

Reset the index, or a level of it.

to_geopandas([nullable])

Returns a new GeoPandas GeoDataFrame object from the coordinates in the cuspatial GeoDataFrame.

to_pandas([nullable])

Calls self.to_geopandas, converting GeoSeries columns into GeoPandas columns and cudf.Series columns into pandas.Series columns, and returning a pandas.DataFrame.

cummax

cummin

cumprod

cumsum

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

Return cumulative max of the IndexedFrame.

Parameters:
axis: {index (0), columns(1)}

Axis for the function to be applied on.

skipna: bool, default True

Exclude NA/null values. If an entire row/column is NA, the result will be NA.

Returns:
IndexedFrame

Examples

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)#

Return cumulative min of the IndexedFrame.

Parameters:
axis: {index (0), columns(1)}

Axis for the function to be applied on.

skipna: bool, default True

Exclude NA/null values. If an entire row/column is NA, the result will be NA.

Returns:
IndexedFrame

Examples

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)#

Return cumulative product of the IndexedFrame.

Parameters:
axis: {index (0), columns(1)}

Axis for the function to be applied on.

skipna: bool, default True

Exclude NA/null values. If an entire row/column is NA, the result will be NA.

Returns:
IndexedFrame

Examples

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)#

Return cumulative sum of the IndexedFrame.

Parameters:
axis: {index (0), columns(1)}

Axis for the function to be applied on.

skipna: bool, default True

Exclude NA/null values. If an entire row/column is NA, the result will be NA.

Returns:
IndexedFrame

Examples

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='')#

Reset the index, or a level of it.

Parameters:
levelint, str, tuple, or list, default None

Only remove the given levels from the index. Removes all levels by default.

dropbool, default False

Do not try to insert index into dataframe columns. This resets the index to the default integer index.

inplacebool, default False

Modify the GeoDataFrame in place (do not create a new object).

col_levelint or str, default 0

If the columns have multiple levels, determines which level the labels are inserted into. By default it is inserted into the first level.

col_fillobject, default “”

If the columns have multiple levels, determines how the other levels are named. If None then the index name is repeated.

Returns:
GeoDataFrame
to_geopandas(nullable=False)#

Returns a new GeoPandas GeoDataFrame object from the coordinates in the cuspatial GeoDataFrame.

Parameters:
nullable: matches the cudf `to_pandas` signature, not yet supported.
to_pandas(nullable=False)#

Calls self.to_geopandas, converting GeoSeries columns into GeoPandas columns and cudf.Series columns into pandas.Series columns, and returning a pandas.DataFrame.

Parameters:
nullable: matches the cudf `to_pandas` signature, not yet supported.
class cuspatial.GeoSeries(data: Optional[Union[GeoSeries, Tuple, T, Series, GeoColumn, list]], index: Union[Index, Index] = None, dtype=None, name=None, nan_as_null=True)#

cuspatial.GeoSeries enables GPU-backed storage and computation of shapely-like objects. Our goal is to give feature parity with GeoPandas. At this time, only from_geopandas and to_geopandas are directly supported. cuspatial GIS, indexing, and trajectory functions depend on the arrays stored in the GeoArrowBuffers object, accessible with the points, multipoints, lines, and polygons accessors.

Examples

>>> 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
Attributes:
column_type

This is used to determine the type of the GeoColumn.

feature_types
iloc

Return the i-th row of the GeoSeries.

lines

Access the LineArray of the underlying GeoArrowBuffers.

loc

Not currently supported.

multipoints

Access the MultiPointArray of the underlying GeoArrowBuffers.

point_indices
points

Access the PointsArray of the underlying GeoArrowBuffers.

polygons

Access the PolygonArray of the underlying GeoArrowBuffers.

sizes

Returns the number of points of each geometry in the GeoSeries.”

type

Methods

GeoSeriesILocIndexer(sr)

Each row of a GeoSeries is one of the six types: Point, MultiPoint, LineString, MultiLineString, Polygon, or MultiPolygon.

GeoSeriesLocIndexer(_sr)

Map the index to an integer Series and use that.

align(other)

Align the rows of two GeoSeries using outer join.

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

Returns a Series of dtype('bool') with value True for each aligned geometry that contains _other_.

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

Returns a Series of dtype('bool') with value True for each aligned geometry that contains _other_.

covers(other[, align])

Compute if a GeoSeries of features A covers a second GeoSeries of features B.

crosses(other[, align])

Returns True for all aligned geometries that cross other, else False.

disjoint(other[, align])

Returns True for all aligned geometries that are disjoint from other, else False.

distance(other[, align])

Returns a Series containing the distance to aligned other.

from_arrow()

Create from PyArrow Array/ChunkedArray.

from_linestrings_xy(linestrings_xy, ...)

Construct a GeoSeries of MULTILINESTRINGs from an array of interleaved xy coordinates.

from_multipoints_xy(multipoints_xy, ...)

Construct a GeoSeries of MULTIPOINTs from an array of interleaved xy coordinates.

from_points_xy(points_xy)

Construct a GeoSeries of POINTs from an array of interleaved xy coordinates.

from_polygons_xy(polygons_xy, ring_offset, ...)

Construct a GeoSeries of MULTIPOLYGONs from an array of interleaved xy coordinates.

geom_equals(other[, align])

Compute if a GeoSeries of features A is equal to a GeoSeries of features B.

intersects(other[, align])

Returns a Series of dtype('bool') with value True for each aligned geometry that intersects _other_.

isna()

Detect missing values.

notna()

Detect non-missing values.

overlaps(other[, align])

Returns True for all aligned geometries that overlap other, else False.

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

Reset the index of the GeoSeries.

to_arrow()

Convert to a GeoArrow Array.

to_geopandas([nullable])

Returns a new GeoPandas GeoSeries object from the coordinates in the cuspatial GeoSeries.

to_pandas()

Treats to_pandas and to_geopandas as the same call, which improves compatibility with pandas.

touches(other[, align])

Returns True for all aligned geometries that touch other, else False.

within(other[, align])

Returns a Series of dtype('bool') with value True for each aligned geometry that is within _other_.

GeoColumnAccessor

LineStringGeoColumnAccessor

MultiPointGeoColumnAccessor

PolygonGeoColumnAccessor

to_shapely

class GeoSeriesILocIndexer(sr)#

Each row of a GeoSeries is one of the six types: Point, MultiPoint, LineString, MultiLineString, Polygon, or MultiPolygon.

class GeoSeriesLocIndexer(_sr)#

Map the index to an integer Series and use that.

align(other)#

Align the rows of two GeoSeries using outer join.

align rearranges two GeoSeries so that their indices match. If one GeoSeries is longer than the other, the shorter GeoSeries will be increased in length and missing index values will be added, inserting None when an empty row is created.

Alignment involves matching the length of the indices, sorting them, and inserting into the right GeoSeries extra index values that are present in the left GeoSeries.

Parameters:
other: GeoSeries
Returns:
(left, right)GeoSeries

Pair of aligned GeoSeries

Examples

>>> 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#

This is used to determine the type of the GeoColumn. It is a value returning method that produces the same result as the various contains_only_* methods, except as an Enum instead of many booleans.

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

Returns a Series of dtype(‘bool’) with value True for each aligned geometry that contains _other_.

An object a is said to contain b if b’s boundary and interiors are within those of a and no point of b lies in the exterior of a.

If allpairs=False, the result will be a Series of dtype(‘bool’). If allpairs=True, the result will be a DataFrame containing two columns, point_indices a`nd polygon_indices, each of which is a Series of dtype(‘int32’). The point_indices Series contains the indices of the points in the right GeoSeries, and the polygon_indices Series contains the indices of the polygons in the left GeoSeries.

Parameters:
otherGeoSeries
alignbool, default False

If True, the two GeoSeries are aligned before performing the operation. If False, the operation is performed on the unaligned GeoSeries.

allpairsbool, default False

If True, the result will be a DataFrame containing two columns, point_indices and polygon_indices, each of which is a Series of dtype(‘int32’). The point_indices Series contains the indices of the points in the right GeoSeries, and the polygon_indices Series contains the indices of the polygons in the left GeoSeries. Excludes boundary points.

modestr, default “full” or “basic_none”, “basic_any”,

“basic_all”, or “basic_count”. If “full”, the result will be a Series of dtype(‘bool’) with value True for each aligned geometry that contains _other_. If “intersects”, the result will be a Series of dtype(‘bool’) with value True for each aligned geometry that contains _other_ or intersects _other_.

Returns:
Series or DataFrame

A Series of dtype(‘bool’) with value True for each aligned geometry that contains _other_. If allpairs=True, the result will be a DataFrame containing two columns, point_indices and polygon_indices, each of which is a Series of dtype(‘int32’).

Notes

allpairs=True excludes geometries that contain points in the boundary of A.

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

Returns a Series of dtype(‘bool’) with value True for each aligned geometry that contains _other_.

Compute from a GeoSeries of points and a GeoSeries of polygons which points are properly contained within the corresponding polygon. Polygon A contains Point B properly if B intersects the interior of A but not the boundary (or exterior).

If allpairs=False, the result will be a Series of dtype(‘bool’). If allpairs=True, the result will be a DataFrame containing two columns, point_indices and polygon_indices, each of which is a Series of dtype(‘int32’). The point_indices Series contains the indices of the points in the right GeoSeries, and the polygon_indices Series contains the indices of the polygons in the left GeoSeries.

Parameters:
other

a cuspatial.GeoSeries

align=True

to align the indices before computing .contains or not. If the indices are not aligned, they will be compared based on their implicit row order.

allpairs=False

True computes the contains for all pairs of geometries between the two GeoSeries. False computes the contains for each geometry in the left GeoSeries against the corresponding geometry in the right GeoSeries. Defaults to False.

Returns:
resultcudf.Series or cudf.DataFrame

A Series of boolean values indicating whether each point falls within the corresponding polygon in the input in the case of allpairs=False. A DataFrame containing two columns, point_indices and polygon_indices, each of which is a Series of dtype(‘int32’) in the case of allpairs=True.

Examples

Test if a polygon is inside another polygon:

>>> 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

Test whether three points fall within either of two polygons >>> 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

Test whether three points fall within either of two polygons using allpairs mode: >>> 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)#

Compute if a GeoSeries of features A covers a second GeoSeries of features B. A covers B if no points on B lie in the exterior of A.

Parameters:
other

a cuspatial.GeoSeries

align=True

align the GeoSeries indexes before calling the binpred

Returns:
resultcudf.Series

A Series of boolean values indicating whether each feature in the input GeoSeries covers the corresponding feature in the other GeoSeries.

crosses(other, align=True)#

Returns True for all aligned geometries that cross other, else False.

Geometries cross if they have some but not all interior points in common, have the same dimension, and the intersection of the interiors of the geometries has the dimension of the geometries themselves minus one.

Parameters:
other

a cuspatial.GeoSeries

align=True

align the GeoSeries indexes before calling the binpred

Returns:
resultcudf.Series

A Series of boolean values indicating whether each geometry crosses the corresponding geometry in the input.

disjoint(other, align=True)#

Returns True for all aligned geometries that are disjoint from other, else False.

An object is said to be disjoint to other if its boundary and interior does not intersect at all with those of the other.

Parameters:
other

a cuspatial.GeoSeries

align=True

align the GeoSeries indexes before calling the binpred

Returns:
resultcudf.Series

A Series of boolean values indicating whether each pair of corresponding geometries is disjoint.

distance(other, align=True)#

Returns a Series containing the distance to aligned other.

The operation works on a 1-to-1 row-wise manner. See geopandas.GeoSeries.distance documentation for details.

Parameters:
other

The GeoSeries (elementwise) or geometric object to find the distance to.

alignbool, default True

If True, automatically aligns GeoSeries based on their indices. If False, the order of the elements is preserved.

Returns:
Series (float)

Notes

Unlike GeoPandas, this API currently only supports geoseries that contain only single type geometries.

Examples

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

By default, geoseries are aligned before computing:

>>> 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

This can be overridden by setting 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()#

Create from PyArrow Array/ChunkedArray.

Parameters:
arrayPyArrow Array/ChunkedArray

PyArrow Object which has to be converted.

Returns:
SingleColumnFrame
Raises:
TypeError for invalid input type.

Examples

>>> import cudf
>>> import pyarrow as pa
>>> cudf.Index.from_arrow(pa.array(["a", "b", None]))
Index(['a', 'b', None], dtype='object')
>>> 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#

Construct a GeoSeries of MULTILINESTRINGs from an array of interleaved xy coordinates.

Parameters:
linestrings_xyarray-like

Coordinates of the linestring, interpreted as interleaved x-y coords.

geometry_offsetarray-like

Offsets of the first coordinate of each geometry. The length of this array is the number of geometries. Offsets with a difference greater than 1 indicate a MultiLinestring.

part_offsetarray-like

Offsets into the coordinates array indicating the beginning of each part. The length of this array is the number of parts.

Returns:
GeoSeries:

A GeoSeries of MULTILINESTRINGs.

classmethod from_multipoints_xy(multipoints_xy, geometry_offset)#

Construct a GeoSeries of MULTIPOINTs from an array of interleaved xy coordinates.

Parameters:
multipoints_xy: array-like

Coordinates of the multipoints, interpreted as interleaved x-y coords.

geometry_offset: array-like

Offsets indicating the starting index of the multipoint. Multiply the index by 2 results in the starting index of the coordinate. See example for detail.

Returns:
GeoSeries:

A GeoSeries made of the points.

classmethod from_points_xy(points_xy)#

Construct a GeoSeries of POINTs from an array of interleaved xy coordinates.

Parameters:
points_xy: array-like

Coordinates of the points, interpreted as interlaved x-y coords.

Returns:
GeoSeries:

A GeoSeries made of the points.

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

Construct a GeoSeries of MULTIPOLYGONs from an array of interleaved xy coordinates.

Parameters:
polygons_xyarray-like

Coordinates of the points, interpreted as interleaved x-y coords.

geometry_offsetarray-like

Offsets of the first coordinate of each geometry. The length of this array is the number of geometries. Offsets with a difference greater than 1 indicate a MultiLinestring.

part_offsetarray-like

Offsets into the coordinates array indicating the beginning of each part. The length of this array is the number of parts.

rint_offsetarray-like

Offsets into the part array indicating the beginning of each ring. The length of this array is the number of rings.

Returns:
GeoSeries:

A GeoSeries of MULTIPOLYGONs.

geom_equals(other, align=True)#

Compute if a GeoSeries of features A is equal to a GeoSeries of features B. Features are equal if their vertices are equal.

An object is equal to other if its set-theoretic boundary, interior, and exterior coincide with those of the other object.

Parameters:
other

a cuspatial.GeoSeries

align=True

to align the indices before computing .contains or not. If the indices are not aligned, they will be compared based on their implicit row order.

Returns:
resultcudf.Series

A Series of boolean values indicating whether each feature in A is equal to the corresponding feature in B.

Examples

Test if two points are equal: >>> point = cuspatial.GeoSeries([Point(0, 0)]) >>> point2 = cuspatial.GeoSeries([Point(0, 0)]) >>> print(point.geom_equals(point2)) 0 True dtype: bool

Test if two polygons are equal: >>> 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#

Return the i-th row of the GeoSeries.

intersects(other, align=True)#

Returns a Series of dtype(‘bool’) with value True for each aligned geometry that intersects _other_.

An object is said to intersect _other_ if its _boundary_ and _interior_ intersects in any way with those of other.

Parameters:
other

a cuspatial.GeoSeries

align=True

align the GeoSeries indexes before calling the binpred

Returns:
resultcudf.Series

A Series of boolean values indicating whether the geometries of each row intersect.

isna()#

Detect missing values.

property lines#

Access the LineArray of the underlying GeoArrowBuffers.

property loc#

Not currently supported.

property multipoints#

Access the MultiPointArray of the underlying GeoArrowBuffers.

notna()#

Detect non-missing values.

overlaps(other, align=True)#

Returns True for all aligned geometries that overlap other, else False.

Geometries overlap if they have more than one but not all points in common, have the same dimension, and the intersection of the interiors of the geometries has the same dimension as the geometries themselves.

Parameters:
other

a cuspatial.GeoSeries

align=True

align the GeoSeries indexes before calling the binpred

Returns:
resultcudf.Series

A Series of boolean values indicating whether each geometry overlaps the corresponding geometry in the input.

property points#

Access the PointsArray of the underlying GeoArrowBuffers.

property polygons#

Access the PolygonArray of the underlying GeoArrowBuffers.

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

Reset the index of the GeoSeries.

Parameters:
levelint, str, tuple, or list, default None

Only remove the given levels from the index. Removes all levels by default.

dropbool, default False

If drop is False, create a new dataframe with the original index as a column. If drop is True, the original index is dropped.

nameobject, optional

The name to use for the column containing the original Series values.

inplace: bool, default False

If True, the original GeoSeries is modified.

Returns:
GeoSeries

GeoSeries with reset index.

Examples

>>> 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#

Returns the number of points of each geometry in the GeoSeries.”

Returns:
sizescudf.Series

The size of each geometry in the GeoSeries.

Notes

The size of a geometry is the number of points it contains. The size of a polygon is the total number of points in all of its rings. The size of a multipolygon is the sum of the sizes of all of its polygons. The size of a linestring is the number of points in its single line. The size of a multilinestring is the sum of the sizes of all of its linestrings. The size of a multipoint is the number of points in its single point. The size of a point is 1.

to_arrow()#

Convert to a GeoArrow Array.

Returns:
result: GeoArrow Union containing GeoArrow Arrays

Examples

>>> 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)#

Returns a new GeoPandas GeoSeries object from the coordinates in the cuspatial GeoSeries.

to_pandas()#

Treats to_pandas and to_geopandas as the same call, which improves compatibility with pandas.

touches(other, align=True)#

Returns True for all aligned geometries that touch other, else False.

Geometries touch if they have any coincident edges or share any vertices, and their interiors do not intersect.

Parameters:
other

a cuspatial.GeoSeries

align=True

align the GeoSeries indexes before calling the binpred

Returns:
resultcudf.Series

A Series of boolean values indicating whether each geometry touches the corresponding geometry in the input.

within(other, align=True)#

Returns a Series of dtype(‘bool’) with value True for each aligned geometry that is within _other_.

An object is said to be within other if at least one of its points is located in the interior and no points are located in the exterior of the other.

Parameters:
other

a cuspatial.GeoSeries

align=True

align the GeoSeries indexes before calling the binpred

Returns:
resultcudf.Series

A Series of boolean values indicating whether each feature falls within the corresponding polygon in the input.