geoai-py 0.5.5__py2.py3-none-any.whl → 0.5.6__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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  __author__ = """Qiusheng Wu"""
4
4
  __email__ = "giswqs@gmail.com"
5
- __version__ = "0.5.5"
5
+ __version__ = "0.5.6"
6
6
 
7
7
 
8
8
  import os
geoai/download.py CHANGED
@@ -1135,7 +1135,37 @@ def view_pc_item(
1135
1135
  map_args=None,
1136
1136
  **kwargs,
1137
1137
  ):
1138
+ """
1139
+ Visualize a STAC item from the Planetary Computer on an interactive map.
1140
+
1141
+ This function allows users to display a STAC item on a map using either the
1142
+ `folium` or `ipyleaflet` backend. It supports adding basemaps, configuring
1143
+ map options, and customizing the visualization of the STAC item.
1144
+
1145
+ Args:
1146
+ url (str, optional): URL of the STAC item to visualize. Defaults to None.
1147
+ collection (str, optional): The collection ID of the STAC item. Defaults to None.
1148
+ item (str or pystac.Item, optional): The STAC item or its ID. Defaults to None.
1149
+ assets (list, optional): List of asset keys to visualize. Defaults to None.
1150
+ bands (list, optional): List of specific bands to visualize. Defaults to None.
1151
+ titiler_endpoint (str, optional): URL of the Titiler endpoint for rendering. Defaults to None.
1152
+ name (str, optional): Name of the layer to display on the map. Defaults to "STAC Item".
1153
+ attribution (str, optional): Attribution text for the layer. Defaults to "Planetary Computer".
1154
+ opacity (float, optional): Opacity of the layer (0.0 to 1.0). Defaults to 1.0.
1155
+ shown (bool, optional): Whether the layer is visible by default. Defaults to True.
1156
+ fit_bounds (bool, optional): Whether to fit the map bounds to the layer. Defaults to True.
1157
+ layer_index (int, optional): Index of the layer in the map's layer stack. Defaults to None.
1158
+ backend (str, optional): Map backend to use ('folium' or 'ipyleaflet'). Defaults to "folium".
1159
+ basemap (str, optional): Name of the basemap to add to the map. Defaults to None.
1160
+ map_args (dict, optional): Additional arguments for configuring the map. Defaults to None.
1161
+ **kwargs: Additional keyword arguments passed to the `add_stac_layer` method.
1138
1162
 
1163
+ Returns:
1164
+ leafmap.Map: An interactive map with the STAC item visualized.
1165
+
1166
+ Raises:
1167
+ ValueError: If an unsupported backend is specified.
1168
+ """
1139
1169
  if backend == "folium":
1140
1170
  import leafmap.foliumap as leafmap
1141
1171
 
@@ -1181,3 +1211,103 @@ def view_pc_item(
1181
1211
  **kwargs,
1182
1212
  )
1183
1213
  return m
1214
+
1215
+
1216
+ def view_pc_items(
1217
+ urls=None,
1218
+ collection=None,
1219
+ items=None,
1220
+ assets=None,
1221
+ bands=None,
1222
+ titiler_endpoint=None,
1223
+ attribution="Planetary Computer",
1224
+ opacity=1.0,
1225
+ shown=True,
1226
+ fit_bounds=True,
1227
+ layer_index=None,
1228
+ backend="folium",
1229
+ basemap=None,
1230
+ map_args=None,
1231
+ **kwargs,
1232
+ ):
1233
+ """
1234
+ Visualize multiple STAC items from the Planetary Computer on an interactive map.
1235
+
1236
+ This function allows users to display multiple STAC items on a map using either
1237
+ the `folium` or `ipyleaflet` backend. It supports adding basemaps, configuring
1238
+ map options, and customizing the visualization of the STAC items.
1239
+
1240
+ Args:
1241
+ urls (list, optional): List of URLs of the STAC items to visualize. Defaults to None.
1242
+ collection (str, optional): The collection ID of the STAC items. Defaults to None.
1243
+ items (list or str, optional): List of STAC items or their IDs. Defaults to None.
1244
+ assets (list, optional): List of asset keys to visualize. Defaults to None.
1245
+ bands (list, optional): List of specific bands to visualize. Defaults to None.
1246
+ titiler_endpoint (str, optional): URL of the Titiler endpoint for rendering. Defaults to None.
1247
+ attribution (str, optional): Attribution text for the layers. Defaults to "Planetary Computer".
1248
+ opacity (float, optional): Opacity of the layers (0.0 to 1.0). Defaults to 1.0.
1249
+ shown (bool, optional): Whether the layers are visible by default. Defaults to True.
1250
+ fit_bounds (bool, optional): Whether to fit the map bounds to the layers. Defaults to True.
1251
+ layer_index (int, optional): Index of the layers in the map's layer stack. Defaults to None.
1252
+ backend (str, optional): Map backend to use ('folium' or 'ipyleaflet'). Defaults to "folium".
1253
+ basemap (str, optional): Name of the basemap to add to the map. Defaults to None.
1254
+ map_args (dict, optional): Additional arguments for configuring the map. Defaults to None.
1255
+ **kwargs: Additional keyword arguments passed to the `add_stac_layer` method.
1256
+
1257
+ Returns:
1258
+ leafmap.Map: An interactive map with the STAC items visualized.
1259
+
1260
+ Raises:
1261
+ ValueError: If an unsupported backend is specified.
1262
+ """
1263
+ if backend == "folium":
1264
+ import leafmap.foliumap as leafmap
1265
+
1266
+ elif backend == "ipyleaflet":
1267
+ import leafmap.leafmap as leafmap
1268
+
1269
+ else:
1270
+ raise ValueError(
1271
+ f"Unsupported backend: {backend}. Supported backends are 'folium' and 'ipyleaflet'."
1272
+ )
1273
+
1274
+ if map_args is None:
1275
+ map_args = {}
1276
+
1277
+ if "draw_control" not in map_args:
1278
+ map_args["draw_control"] = False
1279
+
1280
+ if urls is not None:
1281
+ items = [pystac.Item.from_file(url) for url in urls]
1282
+
1283
+ if isinstance(items, str):
1284
+ items = [pystac.Item.from_file(items)]
1285
+ m = leafmap.Map(**map_args)
1286
+
1287
+ if basemap is not None:
1288
+ m.add_basemap(basemap)
1289
+ if isinstance(items, list):
1290
+
1291
+ for item in items:
1292
+
1293
+ if isinstance(item, pystac.Item):
1294
+ collection = item.collection_id
1295
+ if assets is None:
1296
+ assets = [list(item.assets.keys())[0]]
1297
+ item = item.id
1298
+
1299
+ m.add_stac_layer(
1300
+ collection=collection,
1301
+ item=item,
1302
+ assets=assets,
1303
+ bands=bands,
1304
+ titiler_endpoint=titiler_endpoint,
1305
+ name=item,
1306
+ attribution=attribution,
1307
+ opacity=opacity,
1308
+ shown=shown,
1309
+ fit_bounds=fit_bounds,
1310
+ layer_index=layer_index,
1311
+ **kwargs,
1312
+ )
1313
+ return m
geoai/geoai.py CHANGED
@@ -19,6 +19,7 @@ from .download import (
19
19
  pc_stac_download,
20
20
  read_pc_item_asset,
21
21
  view_pc_item,
22
+ view_pc_items,
22
23
  )
23
24
  from .classify import train_classifier, classify_image, classify_images
24
25
  from .extract import *
geoai/utils.py CHANGED
@@ -2112,7 +2112,7 @@ def raster_to_vector(
2112
2112
  return gdf
2113
2113
 
2114
2114
 
2115
- def batch_raster_to_vector(
2115
+ def raster_to_vector_batch(
2116
2116
  input_dir,
2117
2117
  output_dir,
2118
2118
  pattern="*.tif",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geoai-py
3
- Version: 0.5.5
3
+ Version: 0.5.6
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,16 @@
1
+ geoai/__init__.py,sha256=aEive0DNN76ztdahgu3zV4CwuIRiQQ6E8CCpD4qI3eE,3765
2
+ geoai/classify.py,sha256=_e-193QzAx3pIxUflPIsIs1qZevQx5ADu7i3bOL1G70,35055
3
+ geoai/download.py,sha256=EQpcrcqMsYhDpd7bpjf4hGS5xL2oO-jsjngLgjjP3cE,46599
4
+ geoai/extract.py,sha256=GocJufMmrwEWxNBL1J91EXXHL8AKcO8m_lmtUF5AKPw,119102
5
+ geoai/geoai.py,sha256=jB5LvapKG0yg1jiVceyU1GSRZj-RSSwWuAmogvsfRpU,9340
6
+ geoai/hf.py,sha256=mLKGxEAS5eHkxZLwuLpYc1o7e3-7QIXdBv-QUY-RkFk,17072
7
+ geoai/segment.py,sha256=g3YW17ftr--CKq6VB32TJEPY8owGQ7uQ0sg_tUT2ooE,13681
8
+ geoai/segmentation.py,sha256=AtPzCvguHAEeuyXafa4bzMFATvltEYcah1B8ZMfkM_s,11373
9
+ geoai/train.py,sha256=mQXat2yuddT-2rME4xnX_m3SkY23E_-zdxLnBIKxw8o,44091
10
+ geoai/utils.py,sha256=sPEVSGDHmgbTs078pES_K0HGmYMwNWw7XNCF-DwydWg,244383
11
+ geoai_py-0.5.6.dist-info/licenses/LICENSE,sha256=vN2L5U7cZ6ZkOHFmc8WiGlsogWsZc5dllMeNxnKVOZg,1070
12
+ geoai_py-0.5.6.dist-info/METADATA,sha256=oH93RwL6Y_PB29uc9q0kioYo986fZe_XEX2vtP2ErtA,6623
13
+ geoai_py-0.5.6.dist-info/WHEEL,sha256=AeO2BvogYWm3eGaHCvhzmUYt8ia7KfURiHzO_1atlys,109
14
+ geoai_py-0.5.6.dist-info/entry_points.txt,sha256=uGp3Az3HURIsRHP9v-ys0hIbUuBBNUfXv6VbYHIXeg4,41
15
+ geoai_py-0.5.6.dist-info/top_level.txt,sha256=1YkCUWu-ii-0qIex7kbwAvfei-gos9ycyDyUCJPNWHY,6
16
+ geoai_py-0.5.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (79.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any
@@ -1,16 +0,0 @@
1
- geoai/__init__.py,sha256=IOmIEHpwSXTIcrja0XC9W8ltKl6LfHEFUHSaFedMhAI,3765
2
- geoai/classify.py,sha256=_e-193QzAx3pIxUflPIsIs1qZevQx5ADu7i3bOL1G70,35055
3
- geoai/download.py,sha256=PjGiPP8Q37_3XU1R4aWxu8iDIHVOBpHoJGGdrPDWchw,40892
4
- geoai/extract.py,sha256=GocJufMmrwEWxNBL1J91EXXHL8AKcO8m_lmtUF5AKPw,119102
5
- geoai/geoai.py,sha256=qstOl2BKlvaVndrldUN3v-t--v0qMEFkKKvmH0FhGuc,9321
6
- geoai/hf.py,sha256=mLKGxEAS5eHkxZLwuLpYc1o7e3-7QIXdBv-QUY-RkFk,17072
7
- geoai/segment.py,sha256=g3YW17ftr--CKq6VB32TJEPY8owGQ7uQ0sg_tUT2ooE,13681
8
- geoai/segmentation.py,sha256=AtPzCvguHAEeuyXafa4bzMFATvltEYcah1B8ZMfkM_s,11373
9
- geoai/train.py,sha256=mQXat2yuddT-2rME4xnX_m3SkY23E_-zdxLnBIKxw8o,44091
10
- geoai/utils.py,sha256=dzoOOI30JK8Moj-ygKLtx-dOW2_b7MIKRXQ__gzfg9o,244383
11
- geoai_py-0.5.5.dist-info/licenses/LICENSE,sha256=vN2L5U7cZ6ZkOHFmc8WiGlsogWsZc5dllMeNxnKVOZg,1070
12
- geoai_py-0.5.5.dist-info/METADATA,sha256=vVU3bp2QtxizALztaVnOZtECUtCzlegOojAgR4zigtQ,6623
13
- geoai_py-0.5.5.dist-info/WHEEL,sha256=MAQBAzGbXNI3bUmkDsiV_duv8i-gcdnLzw7cfUFwqhU,109
14
- geoai_py-0.5.5.dist-info/entry_points.txt,sha256=uGp3Az3HURIsRHP9v-ys0hIbUuBBNUfXv6VbYHIXeg4,41
15
- geoai_py-0.5.5.dist-info/top_level.txt,sha256=1YkCUWu-ii-0qIex7kbwAvfei-gos9ycyDyUCJPNWHY,6
16
- geoai_py-0.5.5.dist-info/RECORD,,