Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stubs/geopandas/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "1.1.4"
version = "1.2.0"
upstream-repository = "https://github.com/geopandas/geopandas"
# Requires a version of numpy with a `py.typed` file
dependencies = ["numpy>=1.20", "pandas-stubs", "types-shapely", "pyproj"]
Expand Down
1 change: 0 additions & 1 deletion stubs/geopandas/geopandas/_config.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ class Options:
def __getattr__(self, key: str) -> Any: ...

display_precision: Option
use_pygeos: Option
io_engine: Option
options: Options
12 changes: 7 additions & 5 deletions stubs/geopandas/geopandas/array.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,17 @@ class GeometryArray(ExtensionArray):
def geom_equals_exact(self, other: _ArrayOrGeom, tolerance: float | ArrayLike) -> _Array1D[np.bool_]: ...
def geom_equals_identical(self, other: _ArrayOrGeom) -> _Array1D[np.bool_]: ...
def clip_by_rect(self, xmin: float, ymin: float, xmax: float, ymax: float) -> GeometryArray: ...
def difference(self, other: _ArrayOrGeom) -> GeometryArray: ...
def intersection(self, other: _ArrayOrGeom) -> GeometryArray: ...
def symmetric_difference(self, other: _ArrayOrGeom) -> GeometryArray: ...
def union(self, other: _ArrayOrGeom) -> GeometryArray: ...
def difference(self, other: _ArrayOrGeom, grid_size: float | None = None) -> GeometryArray: ...
def intersection(self, other: _ArrayOrGeom, grid_size: float | None = None) -> GeometryArray: ...
def symmetric_difference(self, other: _ArrayOrGeom, grid_size: float | None = None) -> GeometryArray: ...
def union(self, other: _ArrayOrGeom, grid_size: float | None = None) -> GeometryArray: ...
def shortest_line(self, other: _ArrayOrGeom) -> GeometryArray: ...
def snap(self, other: _ArrayOrGeom, tolerance: float | ArrayLike) -> GeometryArray: ...
def shared_paths(self, other: _ArrayOrGeom) -> GeometryArray: ...
def distance(self, other: _ArrayOrGeom) -> _Array1D[np.float64]: ...
def hausdorff_distance(self, other: _ArrayOrGeom, **kwargs) -> _Array1D[np.float64]: ...
def frechet_distance(self, other: _ArrayOrGeom, **kwargs) -> _Array1D[np.float64]: ...
def buffer(self, distance: float | ArrayLike, resolution: int = 16, **kwargs) -> GeometryArray: ...
def buffer(self, distance: float | ArrayLike, quad_segs: int | None = None, **kwargs) -> GeometryArray: ...
def interpolate(self, distance: float | ArrayLike, normalized: bool = False) -> GeometryArray: ... # type: ignore[override]
def simplify(self, tolerance: float | ArrayLike, preserve_topology: bool = True) -> GeometryArray: ...
def simplify_coverage(self, tolerance: float | ArrayLike, simplify_boundary: bool = True) -> GeometryArray: ...
Expand Down Expand Up @@ -247,6 +247,8 @@ class GeometryArray(ExtensionArray):
def shift(self, periods: int = 1, fill_value: Geometry | None = None) -> GeometryArray: ... # type: ignore[override]
def argmin(self, skipna: bool = True) -> Never: ...
def argmax(self, skipna: bool = True) -> Never: ...
def all(self, *, skipna: bool = True) -> bool: ...
def any(self, *, skipna: bool = True) -> bool: ...
def __array__(self, dtype: DTypeLike | None = None, copy: bool | None = None) -> _Array1D[np.object_]: ...
def __eq__(self, other: object) -> _Array1D[np.bool_]: ... # type: ignore[override]
def __ne__(self, other: object) -> _Array1D[np.bool_]: ... # type: ignore[override]
Expand Down
50 changes: 32 additions & 18 deletions stubs/geopandas/geopandas/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,14 @@ class GeoPandasBase:
def frechet_distance(
self, other: GeoSeries | Geometry, align: bool | None = None, densify: float | ArrayLike | None = None
) -> pd.Series[float]: ...
def difference(self, other: GeoSeries | Geometry, align: bool | None = None) -> GeoSeries: ...
def symmetric_difference(self, other: GeoSeries | Geometry, align: bool | None = None) -> GeoSeries: ...
def union(self, other: GeoSeries | Geometry, align: bool | None = None) -> GeoSeries: ...
def intersection(self, other: GeoSeries | Geometry, align: bool | None = None) -> GeoSeries: ...
def difference(self, other: GeoSeries | Geometry, align: bool | None = None, grid_size: float | None = None) -> GeoSeries: ...
def symmetric_difference(
self, other: GeoSeries | Geometry, align: bool | None = None, grid_size: float | None = None
) -> GeoSeries: ...
def union(self, other: GeoSeries | Geometry, align: bool | None = None, grid_size: float | None = None) -> GeoSeries: ...
def intersection(
self, other: GeoSeries | Geometry, align: bool | None = None, grid_size: float | None = None
) -> GeoSeries: ...
def clip_by_rect(self, xmin: float, ymin: float, xmax: float, ymax: float) -> GeoSeries: ...
def shortest_line(self, other: GeoSeries | Geometry, align: bool | None = None) -> GeoSeries: ...
def snap(self, other: GeoSeries | Geometry, tolerance: float | ArrayLike, align: bool | None = None) -> GeoSeries: ...
Expand All @@ -181,16 +185,32 @@ class GeoPandasBase:
def sindex(self) -> SpatialIndex: ...
@property
def has_sindex(self) -> bool: ...

@overload
def buffer(
self,
distance: float | ArrayLike,
quad_segs: int | None = None,
cap_style: Literal["round", "square", "flat"] = "round",
join_style: Literal["round", "mitre", "bevel"] = "round",
mitre_limit: float = 5.0,
single_sided: bool = False,
**kwargs,
) -> GeoSeries: ...
@overload
@deprecated("The `resolution` argument to `buffer` is deprecated, use `quad_segs` instead.")
def buffer(
self,
distance: float | ArrayLike,
resolution: int = 16,
*,
resolution: int,
cap_style: Literal["round", "square", "flat"] = "round",
join_style: Literal["round", "mitre", "bevel"] = "round",
mitre_limit: float = 5.0,
single_sided: bool = False,
**kwargs,
) -> GeoSeries: ...

def simplify(self, tolerance: float | ArrayLike, preserve_topology: bool = True) -> GeoSeries: ...
def simplify_coverage(self, tolerance: float | ArrayLike, *, simplify_boundary: bool = True) -> GeoSeries: ...
def relate(self, other: GeoSeries | Geometry, align: bool | None = None) -> pd.Series[str]: ...
Expand All @@ -214,28 +234,22 @@ class GeoPandasBase:
def hilbert_distance(
self, total_bounds: tuple[float, float, float, float] | Iterable[float] | None = None, level: int = 16
) -> pd.Series[int]: ...

@overload
def sample_points(
self,
size: int | ArrayLike,
method: str = "uniform",
seed: None = None,
rng: int | ArrayLike | SeedSequence | BitGenerator | RandomGenerator | None = None,
**kwargs,
) -> GeoSeries: ...
@overload
@deprecated("Parameter `seed` is deprecated. Use `rng` instead.")
def sample_points(
def make_grid(
self,
size: int | ArrayLike,
method: str = "uniform",
*,
seed: int | ArrayLike | SeedSequence | BitGenerator | RandomGenerator,
rng: int | ArrayLike | SeedSequence | BitGenerator | RandomGenerator | None = None,
**kwargs,
cell_size: float,
grid_type: Literal["square", "hexagon"] = "square",
feature_type: Literal["centers", "corners", "polygons"] = "polygons",
offset: tuple[float, float] | None = None,
intersect: bool = True,
flat_topped: bool = False,
) -> GeoSeries: ...

def build_area(self, node: bool = True) -> GeoSeries: ...

@overload
Expand Down
16 changes: 13 additions & 3 deletions stubs/geopandas/geopandas/plotting.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from _typeshed import Incomplete
from collections.abc import Collection, Hashable, Iterable, Mapping, Sequence
from typing import Literal, TypeAlias, overload
Expand All @@ -14,6 +15,9 @@ from .geodataframe import GeoDataFrame
from .geoseries import GeoSeries

_ColorOrColors: TypeAlias = ColorType | Sequence[ColorType] | ArrayLike
ColumnLike: TypeAlias = Hashable | pd.Series | pd.Index | pd.Categorical | NDArray[Incomplete] | Sequence[Incomplete] | None
# Also accepts xyzservices.TileProvider and rasterio.io.MemoryFile
_Tiles: TypeAlias = bool | str | os.PathLike[str] | Incomplete

def plot_series(
s: GeoSeries,
Expand All @@ -23,6 +27,9 @@ def plot_series(
figsize: tuple[float, float] | None = None,
aspect: Literal["auto", "equal"] | float | None = "auto",
autolim: bool = True,
tiles: _Tiles = False,
attr: str | None = None,
add_labels: bool = True,
*,
# Extracted from `**style_kwds`
vmin: float = ...,
Expand All @@ -35,7 +42,7 @@ def plot_series(
# IMPORTANT: keep roughly in sync with `GeoplotAccessor` methods below
def plot_dataframe(
df: GeoDataFrame,
column: Hashable | None = None,
column: ColumnLike = None,
cmap: str | Colormap | None = None,
color: _ColorOrColors | None = None,
ax: Axes | None = None,
Expand All @@ -54,6 +61,9 @@ def plot_dataframe(
missing_kwds: dict[str, Incomplete] | None = None,
aspect: Literal["auto", "equal"] | float | None = "auto",
autolim: bool = True,
tiles: _Tiles = False,
attr: str | None = None,
add_labels: bool = True,
*,
# Extracted from `**style_kwds`
norm: Normalize | None = None,
Expand Down Expand Up @@ -197,7 +207,7 @@ class GeoplotAccessor(PlotAccessor):
@overload
def __call__(
self,
column: Hashable | pd.Series | pd.Index | NDArray | None = None,
column: ColumnLike = None,
cmap: str | Colormap | None = None,
color: _ColorOrColors | None = None,
ax: Axes | None = None,
Expand Down Expand Up @@ -229,7 +239,7 @@ class GeoplotAccessor(PlotAccessor):

def geo(
self,
column: Hashable | pd.Series | pd.Index | NDArray | None = None,
column: ColumnLike = None,
cmap: str | Colormap | None = None,
color: _ColorOrColors | None = None,
ax: Axes | None = None,
Expand Down
3 changes: 2 additions & 1 deletion stubs/geopandas/geopandas/tools/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from .clip import clip as clip
from .geocoding import geocode as geocode, reverse_geocode as reverse_geocode
from .make_grid import make_grid as make_grid
from .overlay import overlay as overlay
from .sjoin import sjoin as sjoin, sjoin_nearest as sjoin_nearest
from .util import collect as collect

__all__ = ["collect", "geocode", "overlay", "reverse_geocode", "sjoin", "sjoin_nearest", "clip"]
__all__ = ["collect", "geocode", "make_grid", "overlay", "reverse_geocode", "sjoin", "sjoin_nearest", "clip"]
17 changes: 17 additions & 0 deletions stubs/geopandas/geopandas/tools/make_grid.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from typing import Literal

from shapely import MultiPolygon, Polygon

from ..geodataframe import GeoDataFrame
from ..geoseries import GeoSeries

def make_grid(
input_geometry: Polygon | MultiPolygon | GeoSeries | GeoDataFrame,
/,
cell_size: float,
grid_type: Literal["square", "hexagon"] = "square",
feature_type: Literal["centers", "corners", "polygons"] = "polygons",
offset: tuple[float, float] | None = None,
intersect: bool = True,
flat_topped: bool = False,
) -> GeoSeries: ...
Loading