shared_paths#

GeosSeriesAccessor.shared_paths(other=None, manner=None, **kwargs)#

Returns the shared paths between geom1 and geom2.

Applies shapely.linear.shared_paths to (self, other) and returns the result. If no other data is given, the function gets applied to all possible combinations of the self data, by expanding the array.

Parameters:
  • other (pandas.Series or numpy.ndarray or shapely.Geometry, optional) – Second argument to shared_paths; Default self.

  • manner ('keep' or 'align' or 'expand', optional) – How to apply the shared_paths to the data; Default None .

  • kwargs – Keyword arguments passed to shared_paths.

Returns:

Series with the result of the function applied to self and other, with the same index as self. numpy.ndarray: 2-Dimensional array with the results of the function applied to each combination of geometries between self and other.

Return type:

pandas.Series

Raises:

ValueErrorother argument is not a geos Series or shapely NumPy Array

Note

The manner argument dictates how the data gets transformed before applying shared_paths:

  • keep:

    Keep the original data as is and simply run the function. This returns a Series where the index is the same as the self data.

  • align:

    Align both Series according to their index, before running the function (we align the data according the self data). This returns a Series where the index is the same as the self data.

  • expand:

    Expand the data with a new index, before running the function. This means that the result will be an array of dimensions <len(a), len(b)> containing the result of all possible combinations of geometries.

Of course, not every method is applicable for each type of other input. Here are the allowed manners for each type of input, as well as the default value:

  • Series: keep, align, expand (default: align)

  • 1D ndarray: keep, expand (default: keep)

  • nD ndarray: keep (default: keep)

  • Geometry: keep (default: keep)

  • None (aka. use self): expand (default: expand)