geoai-py 0.21.0__py2.py3-none-any.whl → 0.23.0__py2.py3-none-any.whl
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.
- geoai/__init__.py +1 -1
- geoai/utils.py +67 -0
- {geoai_py-0.21.0.dist-info → geoai_py-0.23.0.dist-info}/METADATA +5 -2
- {geoai_py-0.21.0.dist-info → geoai_py-0.23.0.dist-info}/RECORD +8 -8
- {geoai_py-0.21.0.dist-info → geoai_py-0.23.0.dist-info}/WHEEL +0 -0
- {geoai_py-0.21.0.dist-info → geoai_py-0.23.0.dist-info}/entry_points.txt +0 -0
- {geoai_py-0.21.0.dist-info → geoai_py-0.23.0.dist-info}/licenses/LICENSE +0 -0
- {geoai_py-0.21.0.dist-info → geoai_py-0.23.0.dist-info}/top_level.txt +0 -0
geoai/__init__.py
CHANGED
geoai/utils.py
CHANGED
|
@@ -7848,3 +7848,70 @@ def empty_cache() -> None:
|
|
|
7848
7848
|
torch.cuda.empty_cache()
|
|
7849
7849
|
elif getattr(torch.backends, "mps", None) and torch.backends.mps.is_available():
|
|
7850
7850
|
torch.mps.empty_cache()
|
|
7851
|
+
|
|
7852
|
+
|
|
7853
|
+
def smooth_vector(
|
|
7854
|
+
vector_data: Union[str, gpd.GeoDataFrame],
|
|
7855
|
+
output_path: str = None,
|
|
7856
|
+
segment_length: float = None,
|
|
7857
|
+
smooth_iterations: int = 3,
|
|
7858
|
+
num_cores: int = 0,
|
|
7859
|
+
merge_collection: bool = True,
|
|
7860
|
+
merge_field: str = None,
|
|
7861
|
+
merge_multipolygons: bool = True,
|
|
7862
|
+
preserve_area: bool = True,
|
|
7863
|
+
area_tolerance: float = 0.01,
|
|
7864
|
+
**kwargs: Any,
|
|
7865
|
+
) -> gpd.GeoDataFrame:
|
|
7866
|
+
"""Smooth a vector data using the smoothify library.
|
|
7867
|
+
See https://github.com/DPIRD-DMA/Smoothify for more details.
|
|
7868
|
+
|
|
7869
|
+
Args:
|
|
7870
|
+
vector_data: The vector data to smooth.
|
|
7871
|
+
output_path: The path to save the smoothed vector data. If None, returns the smoothed vector data.
|
|
7872
|
+
segment_length: Resolution of the original raster data in map units. If None (default), automatically
|
|
7873
|
+
detects by finding the minimum segment length (from a data sample). Recommended to specify explicitly when known.
|
|
7874
|
+
smooth_iterations: The number of iterations to smooth the vector data.
|
|
7875
|
+
num_cores: Number of cores to use for parallel processing. If 0 (default), uses all available cores.
|
|
7876
|
+
merge_collection: Whether to merge/dissolve adjacent geometries in collections before smoothing.
|
|
7877
|
+
merge_field: Column name to use for dissolving geometries. Only valid when merge_collection=True.
|
|
7878
|
+
If None, dissolves all geometries together. If specified, dissolves geometries grouped by the column values.
|
|
7879
|
+
merge_multipolygons: Whether to merge adjacent polygons within MultiPolygons before smoothing
|
|
7880
|
+
preserve_area: Whether to restore original area after smoothing via buffering (applies to Polygons only)
|
|
7881
|
+
area_tolerance: Percentage of original area allowed as error (e.g., 0.01 = 0.01% error = 99.99% preservation).
|
|
7882
|
+
Only affects Polygons when preserve_area=True
|
|
7883
|
+
|
|
7884
|
+
Returns:
|
|
7885
|
+
gpd.GeoDataFrame: The smoothed vector data.
|
|
7886
|
+
|
|
7887
|
+
Examples:
|
|
7888
|
+
>>> import geoai
|
|
7889
|
+
>>> gdf = geoai.read_vector("path/to/vector.geojson")
|
|
7890
|
+
>>> smoothed_gdf = geoai.smooth_vector(gdf, smooth_iterations=3, output_path="path/to/smoothed_vector.geojson")
|
|
7891
|
+
>>> smoothed_gdf.head()
|
|
7892
|
+
>>> smoothed_gdf.explore()
|
|
7893
|
+
"""
|
|
7894
|
+
try:
|
|
7895
|
+
from smoothify import smoothify
|
|
7896
|
+
except ImportError:
|
|
7897
|
+
install_package("smoothify")
|
|
7898
|
+
from smoothify import smoothify
|
|
7899
|
+
|
|
7900
|
+
if isinstance(vector_data, str):
|
|
7901
|
+
vector_data = leafmap.read_vector(vector_data)
|
|
7902
|
+
|
|
7903
|
+
smoothed_vector_data = smoothify(
|
|
7904
|
+
geom=vector_data,
|
|
7905
|
+
segment_length=segment_length,
|
|
7906
|
+
smooth_iterations=smooth_iterations,
|
|
7907
|
+
num_cores=num_cores,
|
|
7908
|
+
merge_collection=merge_collection,
|
|
7909
|
+
merge_field=merge_field,
|
|
7910
|
+
merge_multipolygons=merge_multipolygons,
|
|
7911
|
+
preserve_area=preserve_area,
|
|
7912
|
+
area_tolerance=area_tolerance,
|
|
7913
|
+
**kwargs,
|
|
7914
|
+
)
|
|
7915
|
+
if output_path is not None:
|
|
7916
|
+
smoothed_vector_data.to_file(output_path)
|
|
7917
|
+
return smoothed_vector_data
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: geoai-py
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.23.0
|
|
4
4
|
Summary: A Python package for using Artificial Intelligence (AI) with geospatial data
|
|
5
5
|
Author-email: Qiusheng Wu <giswqs@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -38,6 +38,7 @@ Requires-Dist: rasterio
|
|
|
38
38
|
Requires-Dist: rioxarray
|
|
39
39
|
Requires-Dist: scikit-image
|
|
40
40
|
Requires-Dist: scikit-learn
|
|
41
|
+
Requires-Dist: smoothify
|
|
41
42
|
Requires-Dist: timm
|
|
42
43
|
Requires-Dist: tokenizers>=0.22.1
|
|
43
44
|
Requires-Dist: torch
|
|
@@ -51,6 +52,7 @@ Requires-Dist: torchange; extra == "extra"
|
|
|
51
52
|
Requires-Dist: lightly-train; extra == "extra"
|
|
52
53
|
Requires-Dist: multiclean; extra == "extra"
|
|
53
54
|
Requires-Dist: omnicloudmask; extra == "extra"
|
|
55
|
+
Requires-Dist: smoothify; extra == "extra"
|
|
54
56
|
Provides-Extra: agents
|
|
55
57
|
Requires-Dist: strands-agents; extra == "agents"
|
|
56
58
|
Requires-Dist: strands-agents-tools; extra == "agents"
|
|
@@ -70,6 +72,7 @@ Dynamic: license-file
|
|
|
70
72
|
[](https://github.com/conda-forge/geoai-py-feedstock)
|
|
71
73
|
[](https://opensource.org/licenses/MIT)
|
|
72
74
|
[](https://tinyurl.com/GeoAI-Tutorials)
|
|
75
|
+
[](https://opengeoai.org/qgis_plugin)
|
|
73
76
|
|
|
74
77
|
[](https://github.com/opengeos/geoai/blob/master/docs/assets/logo.png)
|
|
75
78
|
|
|
@@ -166,7 +169,7 @@ mamba install -c conda-forge geoai
|
|
|
166
169
|
|
|
167
170
|
Check out the [QGIS Plugin](https://opengeoai.org/qgis_plugin/) page if you are interested in using GeoAI with QGIS.
|
|
168
171
|
|
|
169
|
-
[](https://youtu.be/8-OhlqeoyiY)
|
|
170
173
|
|
|
171
174
|
## 📋 Documentation
|
|
172
175
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
geoai/__init__.py,sha256=
|
|
1
|
+
geoai/__init__.py,sha256=W7iDdT6wmHmzC8CjHK49r-3eeMfoEHguhQcVmqVU6NY,5171
|
|
2
2
|
geoai/auto.py,sha256=OPj_wsSlMCvVNmpPu28k3255AbMX-a5_DkAO6VZ_edA,69220
|
|
3
3
|
geoai/change_detection.py,sha256=pdQofnPRiwoES8vMln2vHghRnpeTdsmqLir74dnqZYU,60389
|
|
4
4
|
geoai/classify.py,sha256=0DcComVR6vKU4qWtH2oHVeXc7ZTcV0mFvdXRtlNmolo,35637
|
|
@@ -18,7 +18,7 @@ geoai/segmentation.py,sha256=7yEzBSKCyHW1dNssoK0rdvhxi2IXsIQIFSga817KdI4,11535
|
|
|
18
18
|
geoai/timm_segment.py,sha256=GfvWmxT6t1S99-iZOf8PlsCkwodIUyrt0AwO_j6dCjE,38470
|
|
19
19
|
geoai/timm_train.py,sha256=y_Sm9Fwe7bTsHEKdtPee5rGY7s01CbkAZKP1TwUDXlU,20551
|
|
20
20
|
geoai/train.py,sha256=NtT5EDoHEQKFUcAdEy4zVkGsJU8pqzk8H9alfR90BSY,175838
|
|
21
|
-
geoai/utils.py,sha256=
|
|
21
|
+
geoai/utils.py,sha256=mmQUR7h5J5ZTt2YsMrWd-aNCXfhFXkVG89cBDYN2lgo,304210
|
|
22
22
|
geoai/agents/__init__.py,sha256=K9htapECbC0h4BE2Ic4DW7GC6TuR9wNZ6HDZ2HkI6vI,310
|
|
23
23
|
geoai/agents/catalog_models.py,sha256=19E-PiE7FvpGEiOi4gDMKPf257FOhLseuVGWJbOjrDs,2089
|
|
24
24
|
geoai/agents/catalog_tools.py,sha256=psVw7-di65hhnJUFqWXFoOkbGaG2_sHrQhA5vdXp3x4,33597
|
|
@@ -30,9 +30,9 @@ geoai/tools/__init__.py,sha256=DE1kZOxzaW8C89TfOWQ3Vdv4WsBLV_SFiFWNWVWc4Ys,1922
|
|
|
30
30
|
geoai/tools/cloudmask.py,sha256=qzvqVa8FAEgd8mePXBaV5Ptx4fHhwfS1BsYL0JAZBjM,14500
|
|
31
31
|
geoai/tools/multiclean.py,sha256=TVwmWgeQyGIyUuCe10b6pGCtgIl8TkZmcgVXPimn9uM,11949
|
|
32
32
|
geoai/tools/sr.py,sha256=kg6Zkq2wB2Ve7c1WblCfbDgd7hFkY65wWgFiD1zC7Vg,7018
|
|
33
|
-
geoai_py-0.
|
|
34
|
-
geoai_py-0.
|
|
35
|
-
geoai_py-0.
|
|
36
|
-
geoai_py-0.
|
|
37
|
-
geoai_py-0.
|
|
38
|
-
geoai_py-0.
|
|
33
|
+
geoai_py-0.23.0.dist-info/licenses/LICENSE,sha256=TlBm8mRusRVB9yF2NTg-STcb71v69-XZaKaPdshqP2I,1074
|
|
34
|
+
geoai_py-0.23.0.dist-info/METADATA,sha256=1u6FsHBBOq_6QxRYcOrrpBlNHrfdz5uPKEGrtKgnEBQ,11754
|
|
35
|
+
geoai_py-0.23.0.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
|
|
36
|
+
geoai_py-0.23.0.dist-info/entry_points.txt,sha256=uGp3Az3HURIsRHP9v-ys0hIbUuBBNUfXv6VbYHIXeg4,41
|
|
37
|
+
geoai_py-0.23.0.dist-info/top_level.txt,sha256=1YkCUWu-ii-0qIex7kbwAvfei-gos9ycyDyUCJPNWHY,6
|
|
38
|
+
geoai_py-0.23.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|