types-shapely 2.0.0.20240526__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- types-shapely-2.0.0.20240526/CHANGELOG.md +4 -0
- types-shapely-2.0.0.20240526/MANIFEST.in +1 -0
- types-shapely-2.0.0.20240526/PKG-INFO +37 -0
- types-shapely-2.0.0.20240526/setup.cfg +4 -0
- types-shapely-2.0.0.20240526/setup.py +51 -0
- types-shapely-2.0.0.20240526/shapely-stubs/METADATA.toml +4 -0
- types-shapely-2.0.0.20240526/shapely-stubs/__init__.pyi +34 -0
- types-shapely-2.0.0.20240526/shapely-stubs/_enum.pyi +5 -0
- types-shapely-2.0.0.20240526/shapely-stubs/_geometry.pyi +184 -0
- types-shapely-2.0.0.20240526/shapely-stubs/_ragged_array.pyi +12 -0
- types-shapely-2.0.0.20240526/shapely-stubs/_typing.pyi +51 -0
- types-shapely-2.0.0.20240526/shapely-stubs/_version.pyi +6 -0
- types-shapely-2.0.0.20240526/shapely-stubs/affinity.pyi +23 -0
- types-shapely-2.0.0.20240526/shapely-stubs/algorithms/__init__.pyi +0 -0
- types-shapely-2.0.0.20240526/shapely-stubs/algorithms/cga.pyi +6 -0
- types-shapely-2.0.0.20240526/shapely-stubs/algorithms/polylabel.pyi +19 -0
- types-shapely-2.0.0.20240526/shapely-stubs/constructive.pyi +430 -0
- types-shapely-2.0.0.20240526/shapely-stubs/coordinates.pyi +43 -0
- types-shapely-2.0.0.20240526/shapely-stubs/coords.pyi +18 -0
- types-shapely-2.0.0.20240526/shapely-stubs/creation.pyi +242 -0
- types-shapely-2.0.0.20240526/shapely-stubs/decorators.pyi +11 -0
- types-shapely-2.0.0.20240526/shapely-stubs/errors.pyi +17 -0
- types-shapely-2.0.0.20240526/shapely-stubs/geometry/__init__.pyi +25 -0
- types-shapely-2.0.0.20240526/shapely-stubs/geometry/base.pyi +285 -0
- types-shapely-2.0.0.20240526/shapely-stubs/geometry/collection.pyi +18 -0
- types-shapely-2.0.0.20240526/shapely-stubs/geometry/geo.pyi +9 -0
- types-shapely-2.0.0.20240526/shapely-stubs/geometry/linestring.pyi +45 -0
- types-shapely-2.0.0.20240526/shapely-stubs/geometry/multilinestring.pyi +15 -0
- types-shapely-2.0.0.20240526/shapely-stubs/geometry/multipoint.pyi +20 -0
- types-shapely-2.0.0.20240526/shapely-stubs/geometry/multipolygon.pyi +22 -0
- types-shapely-2.0.0.20240526/shapely-stubs/geometry/point.pyi +39 -0
- types-shapely-2.0.0.20240526/shapely-stubs/geometry/polygon.pyi +45 -0
- types-shapely-2.0.0.20240526/shapely-stubs/geos.pyi +3 -0
- types-shapely-2.0.0.20240526/shapely-stubs/io.pyi +140 -0
- types-shapely-2.0.0.20240526/shapely-stubs/lib.pyi +167 -0
- types-shapely-2.0.0.20240526/shapely-stubs/linear.pyi +69 -0
- types-shapely-2.0.0.20240526/shapely-stubs/measurement.pyi +68 -0
- types-shapely-2.0.0.20240526/shapely-stubs/ops.pyi +106 -0
- types-shapely-2.0.0.20240526/shapely-stubs/plotting.pyi +76 -0
- types-shapely-2.0.0.20240526/shapely-stubs/predicates.pyi +214 -0
- types-shapely-2.0.0.20240526/shapely-stubs/prepared.pyi +20 -0
- types-shapely-2.0.0.20240526/shapely-stubs/py.typed +0 -0
- types-shapely-2.0.0.20240526/shapely-stubs/set_operations.pyi +86 -0
- types-shapely-2.0.0.20240526/shapely-stubs/speedups.pyi +12 -0
- types-shapely-2.0.0.20240526/shapely-stubs/strtree.pyi +82 -0
- types-shapely-2.0.0.20240526/shapely-stubs/testing.pyi +14 -0
- types-shapely-2.0.0.20240526/shapely-stubs/validation.pyi +7 -0
- types-shapely-2.0.0.20240526/shapely-stubs/vectorized/__init__.pyi +37 -0
- types-shapely-2.0.0.20240526/shapely-stubs/wkb.pyi +16 -0
- types-shapely-2.0.0.20240526/shapely-stubs/wkt.pyi +9 -0
- types-shapely-2.0.0.20240526/types_shapely.egg-info/PKG-INFO +37 -0
- types-shapely-2.0.0.20240526/types_shapely.egg-info/SOURCES.txt +53 -0
- types-shapely-2.0.0.20240526/types_shapely.egg-info/dependency_links.txt +1 -0
- types-shapely-2.0.0.20240526/types_shapely.egg-info/requires.txt +1 -0
- types-shapely-2.0.0.20240526/types_shapely.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include CHANGELOG.md
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: types-shapely
|
|
3
|
+
Version: 2.0.0.20240526
|
|
4
|
+
Summary: Typing stubs for shapely
|
|
5
|
+
Home-page: https://github.com/python/typeshed
|
|
6
|
+
License: Apache-2.0 license
|
|
7
|
+
Project-URL: GitHub, https://github.com/python/typeshed
|
|
8
|
+
Project-URL: Changes, https://github.com/typeshed-internal/stub_uploader/blob/main/data/changelogs/shapely.md
|
|
9
|
+
Project-URL: Issue tracker, https://github.com/python/typeshed/issues
|
|
10
|
+
Project-URL: Chat, https://gitter.im/python/typing
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Typing :: Stubs Only
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
## Typing stubs for shapely
|
|
18
|
+
|
|
19
|
+
This is a [PEP 561](https://peps.python.org/pep-0561/)
|
|
20
|
+
type stub package for the [`shapely`](https://github.com/shapely/shapely) package.
|
|
21
|
+
It can be used by type-checking tools like
|
|
22
|
+
[mypy](https://github.com/python/mypy/),
|
|
23
|
+
[pyright](https://github.com/microsoft/pyright),
|
|
24
|
+
[pytype](https://github.com/google/pytype/),
|
|
25
|
+
PyCharm, etc. to check code that uses
|
|
26
|
+
`shapely`.
|
|
27
|
+
|
|
28
|
+
This version of `types-shapely` aims to provide accurate annotations
|
|
29
|
+
for `shapely==2.0.*`.
|
|
30
|
+
The source for this package can be found at
|
|
31
|
+
https://github.com/python/typeshed/tree/main/stubs/shapely. All fixes for
|
|
32
|
+
types and metadata should be contributed there.
|
|
33
|
+
|
|
34
|
+
See https://github.com/python/typeshed/blob/main/README.md for more details.
|
|
35
|
+
This package was generated from typeshed commit `a83f02c2d9b24831eabb1c8f07bb65576712053a` and was tested
|
|
36
|
+
with mypy 1.10.0, pyright 1.1.364, and
|
|
37
|
+
pytype 2024.4.11.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
|
|
3
|
+
name = "types-shapely"
|
|
4
|
+
description = "Typing stubs for shapely"
|
|
5
|
+
long_description = '''
|
|
6
|
+
## Typing stubs for shapely
|
|
7
|
+
|
|
8
|
+
This is a [PEP 561](https://peps.python.org/pep-0561/)
|
|
9
|
+
type stub package for the [`shapely`](https://github.com/shapely/shapely) package.
|
|
10
|
+
It can be used by type-checking tools like
|
|
11
|
+
[mypy](https://github.com/python/mypy/),
|
|
12
|
+
[pyright](https://github.com/microsoft/pyright),
|
|
13
|
+
[pytype](https://github.com/google/pytype/),
|
|
14
|
+
PyCharm, etc. to check code that uses
|
|
15
|
+
`shapely`.
|
|
16
|
+
|
|
17
|
+
This version of `types-shapely` aims to provide accurate annotations
|
|
18
|
+
for `shapely==2.0.*`.
|
|
19
|
+
The source for this package can be found at
|
|
20
|
+
https://github.com/python/typeshed/tree/main/stubs/shapely. All fixes for
|
|
21
|
+
types and metadata should be contributed there.
|
|
22
|
+
|
|
23
|
+
See https://github.com/python/typeshed/blob/main/README.md for more details.
|
|
24
|
+
This package was generated from typeshed commit `a83f02c2d9b24831eabb1c8f07bb65576712053a` and was tested
|
|
25
|
+
with mypy 1.10.0, pyright 1.1.364, and
|
|
26
|
+
pytype 2024.4.11.
|
|
27
|
+
'''.lstrip()
|
|
28
|
+
|
|
29
|
+
setup(name=name,
|
|
30
|
+
version="2.0.0.20240526",
|
|
31
|
+
description=description,
|
|
32
|
+
long_description=long_description,
|
|
33
|
+
long_description_content_type="text/markdown",
|
|
34
|
+
url="https://github.com/python/typeshed",
|
|
35
|
+
project_urls={
|
|
36
|
+
"GitHub": "https://github.com/python/typeshed",
|
|
37
|
+
"Changes": "https://github.com/typeshed-internal/stub_uploader/blob/main/data/changelogs/shapely.md",
|
|
38
|
+
"Issue tracker": "https://github.com/python/typeshed/issues",
|
|
39
|
+
"Chat": "https://gitter.im/python/typing",
|
|
40
|
+
},
|
|
41
|
+
install_requires=['numpy>=1.20'],
|
|
42
|
+
packages=['shapely-stubs'],
|
|
43
|
+
package_data={'shapely-stubs': ['__init__.pyi', '_enum.pyi', '_geometry.pyi', '_ragged_array.pyi', '_typing.pyi', '_version.pyi', 'affinity.pyi', 'algorithms/__init__.pyi', 'algorithms/cga.pyi', 'algorithms/polylabel.pyi', 'constructive.pyi', 'coordinates.pyi', 'coords.pyi', 'creation.pyi', 'decorators.pyi', 'errors.pyi', 'geometry/__init__.pyi', 'geometry/base.pyi', 'geometry/collection.pyi', 'geometry/geo.pyi', 'geometry/linestring.pyi', 'geometry/multilinestring.pyi', 'geometry/multipoint.pyi', 'geometry/multipolygon.pyi', 'geometry/point.pyi', 'geometry/polygon.pyi', 'geos.pyi', 'io.pyi', 'lib.pyi', 'linear.pyi', 'measurement.pyi', 'ops.pyi', 'plotting.pyi', 'predicates.pyi', 'prepared.pyi', 'set_operations.pyi', 'speedups.pyi', 'strtree.pyi', 'testing.pyi', 'validation.pyi', 'vectorized/__init__.pyi', 'wkb.pyi', 'wkt.pyi', 'METADATA.toml', 'py.typed']},
|
|
44
|
+
license="Apache-2.0 license",
|
|
45
|
+
python_requires=">=3.8",
|
|
46
|
+
classifiers=[
|
|
47
|
+
"License :: OSI Approved :: Apache Software License",
|
|
48
|
+
"Programming Language :: Python :: 3",
|
|
49
|
+
"Typing :: Stubs Only",
|
|
50
|
+
]
|
|
51
|
+
)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from typing import Final
|
|
2
|
+
|
|
3
|
+
from . import affinity as affinity
|
|
4
|
+
from ._geometry import *
|
|
5
|
+
from .constructive import *
|
|
6
|
+
from .coordinates import *
|
|
7
|
+
from .creation import *
|
|
8
|
+
from .errors import setup_signal_checks as setup_signal_checks
|
|
9
|
+
from .geometry import (
|
|
10
|
+
GeometryCollection as GeometryCollection,
|
|
11
|
+
LinearRing as LinearRing,
|
|
12
|
+
LineString as LineString,
|
|
13
|
+
MultiLineString as MultiLineString,
|
|
14
|
+
MultiPoint as MultiPoint,
|
|
15
|
+
MultiPolygon as MultiPolygon,
|
|
16
|
+
Point as Point,
|
|
17
|
+
Polygon as Polygon,
|
|
18
|
+
)
|
|
19
|
+
from .io import *
|
|
20
|
+
from .lib import (
|
|
21
|
+
Geometry as Geometry,
|
|
22
|
+
GEOSException as GEOSException,
|
|
23
|
+
geos_capi_version as geos_capi_version,
|
|
24
|
+
geos_capi_version_string as geos_capi_version_string,
|
|
25
|
+
geos_version as geos_version,
|
|
26
|
+
geos_version_string as geos_version_string,
|
|
27
|
+
)
|
|
28
|
+
from .linear import *
|
|
29
|
+
from .measurement import *
|
|
30
|
+
from .predicates import *
|
|
31
|
+
from .set_operations import *
|
|
32
|
+
from .strtree import *
|
|
33
|
+
|
|
34
|
+
__version__: Final[str]
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
from enum import IntEnum
|
|
2
|
+
from typing import Any, Literal, SupportsIndex, overload
|
|
3
|
+
from typing_extensions import TypeAlias
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
from numpy.typing import NDArray
|
|
7
|
+
|
|
8
|
+
from ._enum import ParamEnum
|
|
9
|
+
from ._typing import ArrayLike, ArrayLikeSeq, GeoArray, OptGeoArrayLike, OptGeoArrayLikeSeq, OptGeoT
|
|
10
|
+
from .geometry import LinearRing, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon
|
|
11
|
+
from .geometry.base import BaseGeometry, BaseMultipartGeometry
|
|
12
|
+
from .lib import Geometry
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"GeometryType",
|
|
16
|
+
"get_type_id",
|
|
17
|
+
"get_dimensions",
|
|
18
|
+
"get_coordinate_dimension",
|
|
19
|
+
"get_num_coordinates",
|
|
20
|
+
"get_srid",
|
|
21
|
+
"set_srid",
|
|
22
|
+
"get_x",
|
|
23
|
+
"get_y",
|
|
24
|
+
"get_z",
|
|
25
|
+
"get_exterior_ring",
|
|
26
|
+
"get_num_points",
|
|
27
|
+
"get_num_interior_rings",
|
|
28
|
+
"get_num_geometries",
|
|
29
|
+
"get_point",
|
|
30
|
+
"get_interior_ring",
|
|
31
|
+
"get_geometry",
|
|
32
|
+
"get_parts",
|
|
33
|
+
"get_rings",
|
|
34
|
+
"get_precision",
|
|
35
|
+
"set_precision",
|
|
36
|
+
"force_2d",
|
|
37
|
+
"force_3d",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
_PrecisionMode: TypeAlias = Literal["valid_output", "pointwise", "keep_collapsed", 0, 1, 2]
|
|
41
|
+
|
|
42
|
+
class GeometryType(IntEnum):
|
|
43
|
+
MISSING = -1
|
|
44
|
+
POINT = 0
|
|
45
|
+
LINESTRING = 1
|
|
46
|
+
LINEARRING = 2
|
|
47
|
+
POLYGON = 3
|
|
48
|
+
MULTIPOINT = 4
|
|
49
|
+
MULTILINESTRING = 5
|
|
50
|
+
MULTIPOLYGON = 6
|
|
51
|
+
GEOMETRYCOLLECTION = 7
|
|
52
|
+
|
|
53
|
+
@overload
|
|
54
|
+
def get_type_id(geometry: Geometry | None, **kwargs) -> int: ...
|
|
55
|
+
@overload
|
|
56
|
+
def get_type_id(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ...
|
|
57
|
+
@overload
|
|
58
|
+
def get_dimensions(geometry: Geometry | None, **kwargs) -> int: ...
|
|
59
|
+
@overload
|
|
60
|
+
def get_dimensions(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ...
|
|
61
|
+
@overload
|
|
62
|
+
def get_coordinate_dimension(geometry: Geometry | None, **kwargs) -> int: ...
|
|
63
|
+
@overload
|
|
64
|
+
def get_coordinate_dimension(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ...
|
|
65
|
+
@overload
|
|
66
|
+
def get_num_coordinates(geometry: Geometry | None, **kwargs) -> int: ...
|
|
67
|
+
@overload
|
|
68
|
+
def get_num_coordinates(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ...
|
|
69
|
+
@overload
|
|
70
|
+
def get_srid(geometry: Geometry | None, **kwargs) -> int: ...
|
|
71
|
+
@overload
|
|
72
|
+
def get_srid(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ...
|
|
73
|
+
@overload
|
|
74
|
+
def set_srid(geometry: OptGeoT, srid: SupportsIndex, **kwargs) -> OptGeoT: ...
|
|
75
|
+
@overload
|
|
76
|
+
def set_srid(geometry: OptGeoArrayLikeSeq, srid: ArrayLike[SupportsIndex], **kwargs) -> GeoArray: ...
|
|
77
|
+
@overload
|
|
78
|
+
def set_srid(geometry: OptGeoArrayLike, srid: ArrayLikeSeq[SupportsIndex], **kwargs) -> GeoArray: ...
|
|
79
|
+
@overload
|
|
80
|
+
def get_x(point: Geometry | None, **kwargs) -> float: ...
|
|
81
|
+
@overload
|
|
82
|
+
def get_x(point: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ...
|
|
83
|
+
@overload
|
|
84
|
+
def get_y(point: Geometry | None, **kwargs) -> float: ...
|
|
85
|
+
@overload
|
|
86
|
+
def get_y(point: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ...
|
|
87
|
+
@overload
|
|
88
|
+
def get_z(point: Geometry | None, **kwargs) -> float: ...
|
|
89
|
+
@overload
|
|
90
|
+
def get_z(point: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ...
|
|
91
|
+
@overload
|
|
92
|
+
def get_point(geometry: LineString, index: SupportsIndex, **kwargs) -> Point | Any: ...
|
|
93
|
+
@overload
|
|
94
|
+
def get_point(geometry: Point | Polygon | BaseMultipartGeometry | None, index: SupportsIndex, **kwargs) -> None: ...
|
|
95
|
+
@overload
|
|
96
|
+
def get_point(geometry: Geometry, index: SupportsIndex, **kwargs) -> Point | None: ...
|
|
97
|
+
@overload
|
|
98
|
+
def get_point(geometry: OptGeoArrayLikeSeq, index: ArrayLike[SupportsIndex], **kwargs) -> GeoArray: ...
|
|
99
|
+
@overload
|
|
100
|
+
def get_point(geometry: OptGeoArrayLike, index: ArrayLikeSeq[SupportsIndex], **kwargs) -> GeoArray: ...
|
|
101
|
+
@overload
|
|
102
|
+
def get_num_points(geometry: Geometry | None, **kwargs) -> int: ...
|
|
103
|
+
@overload
|
|
104
|
+
def get_num_points(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ...
|
|
105
|
+
@overload
|
|
106
|
+
def get_exterior_ring(geometry: Polygon, **kwargs) -> LinearRing: ...
|
|
107
|
+
@overload
|
|
108
|
+
def get_exterior_ring(geometry: Point | LineString | BaseMultipartGeometry | None, **kwargs) -> None: ...
|
|
109
|
+
@overload
|
|
110
|
+
def get_exterior_ring(geometry: Geometry, **kwargs) -> LinearRing | None: ...
|
|
111
|
+
@overload
|
|
112
|
+
def get_exterior_ring(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ...
|
|
113
|
+
@overload
|
|
114
|
+
def get_interior_ring(geometry: Polygon, index: SupportsIndex, **kwargs) -> LinearRing | Any: ...
|
|
115
|
+
@overload
|
|
116
|
+
def get_interior_ring(geometry: Point | LineString | BaseMultipartGeometry | None, index: SupportsIndex, **kwargs) -> None: ...
|
|
117
|
+
@overload
|
|
118
|
+
def get_interior_ring(geometry: Geometry, index: SupportsIndex, **kwargs) -> LinearRing | None: ...
|
|
119
|
+
@overload
|
|
120
|
+
def get_interior_ring(geometry: OptGeoArrayLikeSeq, index: ArrayLike[SupportsIndex], **kwargs) -> GeoArray: ...
|
|
121
|
+
@overload
|
|
122
|
+
def get_interior_ring(geometry: OptGeoArrayLike, index: ArrayLikeSeq[SupportsIndex], **kwargs) -> GeoArray: ...
|
|
123
|
+
@overload
|
|
124
|
+
def get_num_interior_rings(geometry: Geometry | None, **kwargs) -> int: ...
|
|
125
|
+
@overload
|
|
126
|
+
def get_num_interior_rings(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ...
|
|
127
|
+
@overload
|
|
128
|
+
def get_geometry(geometry: MultiPoint, index: SupportsIndex, **kwargs) -> Point | Any: ...
|
|
129
|
+
@overload
|
|
130
|
+
def get_geometry(geometry: MultiLineString, index: SupportsIndex, **kwargs) -> LineString | Any: ...
|
|
131
|
+
@overload
|
|
132
|
+
def get_geometry(geometry: MultiPolygon, index: SupportsIndex, **kwargs) -> Polygon | Any: ...
|
|
133
|
+
@overload
|
|
134
|
+
def get_geometry(geometry: BaseMultipartGeometry, index: SupportsIndex, **kwargs) -> BaseGeometry | Any: ...
|
|
135
|
+
@overload
|
|
136
|
+
def get_geometry(geometry: None, index: SupportsIndex, **kwargs) -> None: ...
|
|
137
|
+
@overload
|
|
138
|
+
def get_geometry(geometry: Geometry | None, index: SupportsIndex, **kwargs) -> BaseGeometry | None: ...
|
|
139
|
+
@overload
|
|
140
|
+
def get_geometry(geometry: OptGeoArrayLikeSeq, index: ArrayLike[SupportsIndex], **kwargs) -> GeoArray: ...
|
|
141
|
+
@overload
|
|
142
|
+
def get_geometry(geometry: OptGeoArrayLike, index: ArrayLikeSeq[SupportsIndex], **kwargs) -> GeoArray: ...
|
|
143
|
+
@overload
|
|
144
|
+
def get_parts(geometry: OptGeoArrayLike, return_index: Literal[False] = False) -> GeoArray: ...
|
|
145
|
+
@overload
|
|
146
|
+
def get_parts(geometry: OptGeoArrayLike, return_index: Literal[True]) -> tuple[GeoArray, NDArray[np.int64]]: ...
|
|
147
|
+
@overload
|
|
148
|
+
def get_parts(geometry: OptGeoArrayLike, return_index: bool) -> GeoArray | tuple[GeoArray, NDArray[np.int64]]: ...
|
|
149
|
+
@overload
|
|
150
|
+
def get_rings(geometry: OptGeoArrayLike, return_index: Literal[False] = False) -> GeoArray: ...
|
|
151
|
+
@overload
|
|
152
|
+
def get_rings(geometry: OptGeoArrayLike, return_index: Literal[True]) -> tuple[GeoArray, NDArray[np.int64]]: ...
|
|
153
|
+
@overload
|
|
154
|
+
def get_rings(geometry: OptGeoArrayLike, return_index: bool) -> GeoArray | tuple[GeoArray, NDArray[np.int64]]: ...
|
|
155
|
+
@overload
|
|
156
|
+
def get_num_geometries(geometry: Geometry | None, **kwargs) -> int: ...
|
|
157
|
+
@overload
|
|
158
|
+
def get_num_geometries(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ...
|
|
159
|
+
@overload
|
|
160
|
+
def get_precision(geometry: Geometry | None, **kwargs) -> float: ...
|
|
161
|
+
@overload
|
|
162
|
+
def get_precision(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ...
|
|
163
|
+
|
|
164
|
+
class SetPrecisionMode(ParamEnum):
|
|
165
|
+
valid_output: int
|
|
166
|
+
pointwise: int
|
|
167
|
+
keep_collapsed: int
|
|
168
|
+
|
|
169
|
+
@overload
|
|
170
|
+
def set_precision(geometry: OptGeoT, grid_size: float, mode: _PrecisionMode = "valid_output", **kwargs) -> OptGeoT: ...
|
|
171
|
+
@overload
|
|
172
|
+
def set_precision(
|
|
173
|
+
geometry: OptGeoArrayLikeSeq, grid_size: float, mode: _PrecisionMode = "valid_output", **kwargs
|
|
174
|
+
) -> GeoArray: ...
|
|
175
|
+
@overload
|
|
176
|
+
def force_2d(geometry: OptGeoT, **kwargs) -> OptGeoT: ...
|
|
177
|
+
@overload
|
|
178
|
+
def force_2d(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ...
|
|
179
|
+
@overload
|
|
180
|
+
def force_3d(geometry: OptGeoT, z: float = 0.0, **kwargs) -> OptGeoT: ...
|
|
181
|
+
@overload
|
|
182
|
+
def force_3d(geometry: OptGeoArrayLikeSeq, z: ArrayLike[float] = 0.0, **kwargs) -> GeoArray: ...
|
|
183
|
+
@overload
|
|
184
|
+
def force_3d(geometry: OptGeoArrayLike, z: ArrayLikeSeq[float], **kwargs) -> GeoArray: ...
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from numpy.typing import NDArray
|
|
3
|
+
|
|
4
|
+
from ._geometry import GeometryType
|
|
5
|
+
from ._typing import ArrayLike, ArrayLikeSeq, GeoArray, OptGeoArrayLikeSeq
|
|
6
|
+
|
|
7
|
+
def to_ragged_array(
|
|
8
|
+
geometries: OptGeoArrayLikeSeq, include_z: bool | None = None
|
|
9
|
+
) -> tuple[GeometryType, NDArray[np.float64], tuple[NDArray[np.int64], ...]]: ...
|
|
10
|
+
def from_ragged_array(
|
|
11
|
+
geometry_type: GeometryType, coords: ArrayLike[float], offsets: ArrayLikeSeq[int] | None = None
|
|
12
|
+
) -> GeoArray: ...
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from collections.abc import Sequence
|
|
3
|
+
from typing import Any, Protocol, TypeVar, type_check_only
|
|
4
|
+
from typing_extensions import TypeAlias
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
from numpy.typing import NDArray
|
|
8
|
+
|
|
9
|
+
from .lib import Geometry
|
|
10
|
+
|
|
11
|
+
if sys.version_info >= (3, 12):
|
|
12
|
+
from collections.abc import Buffer
|
|
13
|
+
|
|
14
|
+
_T = TypeVar("_T")
|
|
15
|
+
_DType = TypeVar("_DType", bound=np.dtype[Any])
|
|
16
|
+
_DType_co = TypeVar("_DType_co", covariant=True, bound=np.dtype[Any])
|
|
17
|
+
|
|
18
|
+
GeoT = TypeVar("GeoT", bound=Geometry) # noqa: Y001
|
|
19
|
+
OptGeoT = TypeVar("OptGeoT", bound=Geometry | None) # noqa: Y001
|
|
20
|
+
|
|
21
|
+
@type_check_only
|
|
22
|
+
class SupportsArray(Protocol[_DType_co]):
|
|
23
|
+
def __array__(self) -> np.ndarray[Any, _DType_co]: ...
|
|
24
|
+
|
|
25
|
+
# TODO revisit when mypy is happy with generic recursive type alias
|
|
26
|
+
# NestedSequence: TypeAlias = Sequence[_T] | Sequence[NestedSequence[_T]]
|
|
27
|
+
NestedSequence: TypeAlias = Sequence[_T] | Sequence[Sequence[_T]] | Sequence[Sequence[Sequence[_T]]]
|
|
28
|
+
DualArrayLike: TypeAlias = SupportsArray[_DType] | NestedSequence[SupportsArray[_DType]] | NestedSequence[_T]
|
|
29
|
+
|
|
30
|
+
# array-like sequences: objects accepted by np.array that produce at least 1-D arrays
|
|
31
|
+
if sys.version_info >= (3, 12):
|
|
32
|
+
ArrayLikeSeq: TypeAlias = Buffer | DualArrayLike[np.dtype[Any], _T]
|
|
33
|
+
else:
|
|
34
|
+
ArrayLikeSeq: TypeAlias = DualArrayLike[np.dtype[Any], _T]
|
|
35
|
+
GeoArrayLikeSeq: TypeAlias = ArrayLikeSeq[Geometry]
|
|
36
|
+
OptGeoArrayLikeSeq: TypeAlias = ArrayLikeSeq[Geometry | None]
|
|
37
|
+
|
|
38
|
+
# array-like: objects accepted by np.array that may also produce 0-D array
|
|
39
|
+
ArrayLike: TypeAlias = _T | ArrayLikeSeq[_T]
|
|
40
|
+
GeoArrayLike: TypeAlias = ArrayLike[Geometry]
|
|
41
|
+
OptGeoArrayLike: TypeAlias = ArrayLike[Geometry | None]
|
|
42
|
+
|
|
43
|
+
# There is no way to pronounce "array of BaseGeometry" currently because of the restriction on
|
|
44
|
+
# NDArray type variable to np.dtype and because np.object_ is not generic.
|
|
45
|
+
# Note the use of `BaseGeometry` instead of `Geometry` as the alias is used in return types.
|
|
46
|
+
GeoArray: TypeAlias = NDArray[np.object_]
|
|
47
|
+
|
|
48
|
+
@type_check_only
|
|
49
|
+
class SupportsGeoInterface(Protocol):
|
|
50
|
+
@property
|
|
51
|
+
def __geo_interface__(self) -> dict[str, Any]: ...
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from collections.abc import Collection
|
|
2
|
+
from typing import Literal, overload
|
|
3
|
+
from typing_extensions import TypeAlias
|
|
4
|
+
|
|
5
|
+
from ._typing import GeoT
|
|
6
|
+
from .geometry import Point
|
|
7
|
+
from .lib import Geometry
|
|
8
|
+
|
|
9
|
+
__all__ = ["affine_transform", "rotate", "scale", "skew", "translate"]
|
|
10
|
+
|
|
11
|
+
_Origin: TypeAlias = Literal["center", "centroid"] | Point | tuple[float, float] | tuple[float, float, float]
|
|
12
|
+
|
|
13
|
+
def affine_transform(geom: GeoT, matrix: Collection[float]) -> GeoT: ...
|
|
14
|
+
@overload
|
|
15
|
+
def interpret_origin(geom: Geometry, origin: _Origin, ndim: Literal[2]) -> tuple[float, float]: ...
|
|
16
|
+
@overload
|
|
17
|
+
def interpret_origin(geom: Geometry, origin: _Origin, ndim: Literal[3]) -> tuple[float, float, float]: ...
|
|
18
|
+
@overload
|
|
19
|
+
def interpret_origin(geom: Geometry, origin: _Origin, ndim: int) -> tuple[float, float] | tuple[float, float, float]: ...
|
|
20
|
+
def rotate(geom: GeoT, angle: float, origin: _Origin = "center", use_radians: bool = False) -> GeoT: ...
|
|
21
|
+
def scale(geom: GeoT, xfact: float = 1.0, yfact: float = 1.0, zfact: float = 1.0, origin: _Origin = "center") -> GeoT: ...
|
|
22
|
+
def skew(geom: GeoT, xs: float = 0.0, ys: float = 0.0, origin: _Origin = "center", use_radians: bool = False) -> GeoT: ...
|
|
23
|
+
def translate(geom: GeoT, xoff: float = 0.0, yoff: float = 0.0, zoff: float = 0.0) -> GeoT: ...
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from ..errors import TopologicalError as TopologicalError
|
|
2
|
+
from ..geometry import Point, Polygon
|
|
3
|
+
|
|
4
|
+
class Cell:
|
|
5
|
+
x: float
|
|
6
|
+
y: float
|
|
7
|
+
h: float
|
|
8
|
+
centroid: Point
|
|
9
|
+
distance: float
|
|
10
|
+
max_distance: float
|
|
11
|
+
def __init__(self, x: float, y: float, h: float, polygon: Polygon) -> None: ...
|
|
12
|
+
def __lt__(self, other: Cell) -> bool: ...
|
|
13
|
+
def __le__(self, other: Cell) -> bool: ...
|
|
14
|
+
def __eq__(self, other: object) -> bool: ...
|
|
15
|
+
def __ne__(self, other: object) -> bool: ...
|
|
16
|
+
def __gt__(self, other: Cell) -> bool: ...
|
|
17
|
+
def __ge__(self, other: Cell) -> bool: ...
|
|
18
|
+
|
|
19
|
+
def polylabel(polygon: Polygon, tolerance: float = 1.0) -> Point: ...
|