geoai-py 0.5.4__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 +1 -1
- geoai/download.py +132 -2
- geoai/geoai.py +3 -0
- geoai/utils.py +2 -2
- {geoai_py-0.5.4.dist-info → geoai_py-0.5.6.dist-info}/METADATA +1 -1
- geoai_py-0.5.6.dist-info/RECORD +16 -0
- {geoai_py-0.5.4.dist-info → geoai_py-0.5.6.dist-info}/WHEEL +1 -1
- geoai_py-0.5.4.dist-info/RECORD +0 -16
- {geoai_py-0.5.4.dist-info → geoai_py-0.5.6.dist-info}/entry_points.txt +0 -0
- {geoai_py-0.5.4.dist-info → geoai_py-0.5.6.dist-info}/licenses/LICENSE +0 -0
- {geoai_py-0.5.4.dist-info → geoai_py-0.5.6.dist-info}/top_level.txt +0 -0
geoai/__init__.py
CHANGED
geoai/download.py
CHANGED
|
@@ -905,7 +905,7 @@ def pc_stac_download(
|
|
|
905
905
|
items,
|
|
906
906
|
output_dir=".",
|
|
907
907
|
assets=None,
|
|
908
|
-
max_workers=
|
|
908
|
+
max_workers=1,
|
|
909
909
|
skip_existing=True,
|
|
910
910
|
):
|
|
911
911
|
"""
|
|
@@ -922,7 +922,7 @@ def pc_stac_download(
|
|
|
922
922
|
assets (list, optional): List of asset keys to download. If None,
|
|
923
923
|
downloads all available assets. Defaults to None.
|
|
924
924
|
max_workers (int, optional): Maximum number of concurrent download threads.
|
|
925
|
-
Defaults to
|
|
925
|
+
Defaults to 1.
|
|
926
926
|
skip_existing (bool, optional): Skip download if the file already exists.
|
|
927
927
|
Defaults to True.
|
|
928
928
|
sign_urls (bool, optional): Whether to sign URLs for authenticated access.
|
|
@@ -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
|
@@ -11,12 +11,15 @@ from .download import (
|
|
|
11
11
|
download_naip,
|
|
12
12
|
download_overture_buildings,
|
|
13
13
|
download_pc_stac_item,
|
|
14
|
+
get_overture_data,
|
|
15
|
+
extract_building_stats,
|
|
14
16
|
pc_collection_list,
|
|
15
17
|
pc_item_asset_list,
|
|
16
18
|
pc_stac_search,
|
|
17
19
|
pc_stac_download,
|
|
18
20
|
read_pc_item_asset,
|
|
19
21
|
view_pc_item,
|
|
22
|
+
view_pc_items,
|
|
20
23
|
)
|
|
21
24
|
from .classify import train_classifier, classify_image, classify_images
|
|
22
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
|
|
2115
|
+
def raster_to_vector_batch(
|
|
2116
2116
|
input_dir,
|
|
2117
2117
|
output_dir,
|
|
2118
2118
|
pattern="*.tif",
|
|
@@ -6235,7 +6235,7 @@ def download_model_from_hf(model_path, repo_id=None):
|
|
|
6235
6235
|
# Define the repository ID and model filename
|
|
6236
6236
|
if repo_id is None:
|
|
6237
6237
|
print(
|
|
6238
|
-
"Repo is
|
|
6238
|
+
"Repo is not specified, using default Hugging Face repo_id: giswqs/geoai"
|
|
6239
6239
|
)
|
|
6240
6240
|
repo_id = "giswqs/geoai"
|
|
6241
6241
|
|
|
@@ -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,,
|
geoai_py-0.5.4.dist-info/RECORD
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
geoai/__init__.py,sha256=_SUkF87skch6o0kWnBmcY5ki_cjE1uSsIVM_ByCU6eA,3765
|
|
2
|
-
geoai/classify.py,sha256=_e-193QzAx3pIxUflPIsIs1qZevQx5ADu7i3bOL1G70,35055
|
|
3
|
-
geoai/download.py,sha256=lJ1GsJOZsKc2i6_dQyPV-XXIXmlADOpmSBo-wha4DEU,40892
|
|
4
|
-
geoai/extract.py,sha256=GocJufMmrwEWxNBL1J91EXXHL8AKcO8m_lmtUF5AKPw,119102
|
|
5
|
-
geoai/geoai.py,sha256=CeVLiK_ly8SG6HBXb8ZrHv_WbPQS3v68NYfXskr1vMM,9270
|
|
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=075-CoiYIYs7ZgtWOnyw5pBaQIeWuBW49JwTYfOBHDI,244386
|
|
11
|
-
geoai_py-0.5.4.dist-info/licenses/LICENSE,sha256=vN2L5U7cZ6ZkOHFmc8WiGlsogWsZc5dllMeNxnKVOZg,1070
|
|
12
|
-
geoai_py-0.5.4.dist-info/METADATA,sha256=aCOkYuGkhV6Iuzv5o5RvJNhAMApwANK9aJqmgPWG6y4,6623
|
|
13
|
-
geoai_py-0.5.4.dist-info/WHEEL,sha256=MAQBAzGbXNI3bUmkDsiV_duv8i-gcdnLzw7cfUFwqhU,109
|
|
14
|
-
geoai_py-0.5.4.dist-info/entry_points.txt,sha256=uGp3Az3HURIsRHP9v-ys0hIbUuBBNUfXv6VbYHIXeg4,41
|
|
15
|
-
geoai_py-0.5.4.dist-info/top_level.txt,sha256=1YkCUWu-ii-0qIex7kbwAvfei-gos9ycyDyUCJPNWHY,6
|
|
16
|
-
geoai_py-0.5.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|