geoai-py 0.3.6__py2.py3-none-any.whl → 0.4.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/utils.py CHANGED
@@ -28,17 +28,10 @@ from rasterio import features
28
28
  from rasterio.plot import show
29
29
  from rasterio.windows import Window
30
30
  from shapely.affinity import rotate
31
- from shapely.geometry import (
32
- MultiPolygon,
33
- Polygon,
34
- box,
35
- mapping,
36
- shape,
37
- )
31
+ from shapely.geometry import MultiPolygon, Polygon, box, mapping, shape
38
32
  from torchvision.transforms import RandomRotation
39
33
  from tqdm import tqdm
40
34
 
41
-
42
35
  try:
43
36
  from torchgeo.datasets import RasterDataset, unbind_samples
44
37
  except ImportError as e:
@@ -700,8 +693,8 @@ def view_vector_interactive(
700
693
  """
701
694
  import folium
702
695
  import folium.plugins as plugins
703
- from localtileserver import get_folium_tile_layer, TileClient
704
696
  from leafmap import cog_tile
697
+ from localtileserver import TileClient, get_folium_tile_layer
705
698
 
706
699
  google_tiles = {
707
700
  "Roadmap": {
@@ -803,9 +796,9 @@ def regularization(
803
796
  Returns:
804
797
  GeoDataFrame or list of shapely Polygons with regularized building footprints
805
798
  """
806
- from shapely.geometry import Polygon, shape
807
- from shapely.affinity import rotate, translate
808
799
  from shapely import wkt
800
+ from shapely.affinity import rotate, translate
801
+ from shapely.geometry import Polygon, shape
809
802
 
810
803
  regularized_buildings = []
811
804
 
@@ -924,8 +917,8 @@ def hybrid_regularization(building_polygons):
924
917
  Returns:
925
918
  GeoDataFrame or list of shapely Polygons with regularized building footprints
926
919
  """
927
- from shapely.geometry import Polygon
928
920
  from shapely.affinity import rotate
921
+ from shapely.geometry import Polygon
929
922
 
930
923
  # Use minimum_rotated_rectangle instead of oriented_envelope
931
924
  try:
@@ -1039,8 +1032,8 @@ def adaptive_regularization(
1039
1032
  Returns:
1040
1033
  GeoDataFrame or list of shapely Polygons with regularized building footprints
1041
1034
  """
1042
- from shapely.geometry import Polygon
1043
1035
  from shapely.affinity import rotate
1036
+ from shapely.geometry import Polygon
1044
1037
 
1045
1038
  # Analyze the overall dataset to set appropriate parameters
1046
1039
  if is_gdf := isinstance(building_polygons, gpd.GeoDataFrame):
@@ -2594,6 +2587,8 @@ def export_geotiff_tiles(
2594
2587
  print(f"\nRaster info for {in_raster}:")
2595
2588
  print(f" CRS: {src.crs}")
2596
2589
  print(f" Dimensions: {src.width} x {src.height}")
2590
+ print(f" Resolution: {src.res}")
2591
+ print(f" Bands: {src.count}")
2597
2592
  print(f" Bounds: {src.bounds}")
2598
2593
 
2599
2594
  # Calculate number of tiles
@@ -4275,9 +4270,10 @@ def read_vector(source, layer=None, **kwargs):
4275
4270
  >>> gdf = read_vector("path/to/data.gpkg", layer="layer_name")
4276
4271
  """
4277
4272
 
4278
- import fiona
4279
4273
  import urllib.parse
4280
4274
 
4275
+ import fiona
4276
+
4281
4277
  # Determine if source is a URL or local file
4282
4278
  parsed_url = urllib.parse.urlparse(source)
4283
4279
  is_url = parsed_url.scheme in ["http", "https"]
@@ -4351,6 +4347,7 @@ def read_raster(source, band=None, masked=True, **kwargs):
4351
4347
  >>> raster = read_raster("path/to/data.tif", masked=False)
4352
4348
  """
4353
4349
  import urllib.parse
4350
+
4354
4351
  from rasterio.errors import RasterioIOError
4355
4352
 
4356
4353
  # Determine if source is a URL or local file
@@ -4445,8 +4442,8 @@ def region_groups(
4445
4442
  Returns:
4446
4443
  Union[Tuple[np.ndarray, pd.DataFrame], Tuple[xr.DataArray, pd.DataFrame]]: Labeled image and properties DataFrame.
4447
4444
  """
4448
- from skimage import measure
4449
4445
  import scipy.ndimage as ndi
4446
+ from skimage import measure
4450
4447
 
4451
4448
  if isinstance(image, str):
4452
4449
  ds = rxr.open_rasterio(image)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: geoai-py
3
- Version: 0.3.6
3
+ Version: 0.4.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
@@ -0,0 +1,15 @@
1
+ geoai/__init__.py,sha256=rtBuAkA1JMtY_o_PE3kdaFftrp5K9YBQxdi5y99ktPU,923
2
+ geoai/download.py,sha256=eqMecJqvqyrIVFViNA7pW8a5EIhqYJzRILmxQoFHG2k,13095
3
+ geoai/extract.py,sha256=CCXjUcGC4ZOKOKKjvElp8VFmTz46b0ATvGitbOPgTwE,95506
4
+ geoai/geoai.py,sha256=L1jkozDcjqJXvqT6i8oW04Ix9x4cc2-LNYi9_564ABQ,163
5
+ geoai/hf.py,sha256=mLKGxEAS5eHkxZLwuLpYc1o7e3-7QIXdBv-QUY-RkFk,17072
6
+ geoai/segment.py,sha256=g3YW17ftr--CKq6VB32TJEPY8owGQ7uQ0sg_tUT2ooE,13681
7
+ geoai/segmentation.py,sha256=AtPzCvguHAEeuyXafa4bzMFATvltEYcah1B8ZMfkM_s,11373
8
+ geoai/train.py,sha256=VaeFzIkVUNTdre8ImgUNhmbpA42qijSXaajLpmBF_Ic,36248
9
+ geoai/utils.py,sha256=Q5f-mFVjer7BKipt4GOI9QFvTRsdB8V48LpkqlfBg2o,223437
10
+ geoai_py-0.4.0.dist-info/LICENSE,sha256=vN2L5U7cZ6ZkOHFmc8WiGlsogWsZc5dllMeNxnKVOZg,1070
11
+ geoai_py-0.4.0.dist-info/METADATA,sha256=xRCruLClbNxRuXn3A-729IWqiyO-B08VFbpMvrN-ErI,6297
12
+ geoai_py-0.4.0.dist-info/WHEEL,sha256=SrDKpSbFN1G94qcmBqS9nyHcDMp9cUS9OC06hC0G3G0,109
13
+ geoai_py-0.4.0.dist-info/entry_points.txt,sha256=uGp3Az3HURIsRHP9v-ys0hIbUuBBNUfXv6VbYHIXeg4,41
14
+ geoai_py-0.4.0.dist-info/top_level.txt,sha256=1YkCUWu-ii-0qIex7kbwAvfei-gos9ycyDyUCJPNWHY,6
15
+ geoai_py-0.4.0.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- geoai/__init__.py,sha256=vsoVgC5QbrVHI4xAGVZLh7C1RxBLKFdGk8KubSwKzTE,923
2
- geoai/download.py,sha256=4GiDmLrp2wKslgfm507WeZrwOdYcMekgQXxWGbl5cBw,13094
3
- geoai/extract.py,sha256=v_4i_pSQYrdpNZZsGvVaa6Lo0AC7bHUaNp5bs_O4kS4,94255
4
- geoai/geoai.py,sha256=di-lh7704BpwltR5cxz09AtCx2EaNkvtUJxRakkYPpc,87
5
- geoai/segment.py,sha256=ULe0Xq2RnA7p6d8vKm0rYqHQW6G_3dOxpd_1W0x9UOU,13680
6
- geoai/segmentation.py,sha256=Vcymnhwl_xikt4v9x8CYJq_vId9R1gB7-YzLfwg-F9M,11372
7
- geoai/utils.py,sha256=DKHLLLus-R12pJCFknPvktXbju8nC8SSYcsbDjykovg,223372
8
- geoai_py-0.3.6.dist-info/LICENSE,sha256=vN2L5U7cZ6ZkOHFmc8WiGlsogWsZc5dllMeNxnKVOZg,1070
9
- geoai_py-0.3.6.dist-info/METADATA,sha256=wzNDh3GiOtZVzA4QDhuUWc3KTtNVqwvc4rDQSgyfeFc,6297
10
- geoai_py-0.3.6.dist-info/WHEEL,sha256=SrDKpSbFN1G94qcmBqS9nyHcDMp9cUS9OC06hC0G3G0,109
11
- geoai_py-0.3.6.dist-info/entry_points.txt,sha256=uGp3Az3HURIsRHP9v-ys0hIbUuBBNUfXv6VbYHIXeg4,41
12
- geoai_py-0.3.6.dist-info/top_level.txt,sha256=1YkCUWu-ii-0qIex7kbwAvfei-gos9ycyDyUCJPNWHY,6
13
- geoai_py-0.3.6.dist-info/RECORD,,