geoai-py 0.18.0__py2.py3-none-any.whl → 0.18.1__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 +59 -45
- {geoai_py-0.18.0.dist-info → geoai_py-0.18.1.dist-info}/METADATA +2 -2
- {geoai_py-0.18.0.dist-info → geoai_py-0.18.1.dist-info}/RECORD +8 -8
- {geoai_py-0.18.0.dist-info → geoai_py-0.18.1.dist-info}/WHEEL +0 -0
- {geoai_py-0.18.0.dist-info → geoai_py-0.18.1.dist-info}/entry_points.txt +0 -0
- {geoai_py-0.18.0.dist-info → geoai_py-0.18.1.dist-info}/licenses/LICENSE +0 -0
- {geoai_py-0.18.0.dist-info → geoai_py-0.18.1.dist-info}/top_level.txt +0 -0
geoai/__init__.py
CHANGED
geoai/utils.py
CHANGED
|
@@ -64,7 +64,7 @@ def view_raster(
|
|
|
64
64
|
client_args: Optional[Dict] = {"cors_all": False},
|
|
65
65
|
basemap: Optional[str] = "OpenStreetMap",
|
|
66
66
|
basemap_args: Optional[Dict] = None,
|
|
67
|
-
backend: Optional[str] = "
|
|
67
|
+
backend: Optional[str] = "folium",
|
|
68
68
|
**kwargs: Any,
|
|
69
69
|
) -> Any:
|
|
70
70
|
"""
|
|
@@ -87,7 +87,7 @@ def view_raster(
|
|
|
87
87
|
client_args (Optional[Dict], optional): Additional arguments for the client. Defaults to {"cors_all": False}.
|
|
88
88
|
basemap (Optional[str], optional): The basemap to use. Defaults to "OpenStreetMap".
|
|
89
89
|
basemap_args (Optional[Dict], optional): Additional arguments for the basemap. Defaults to None.
|
|
90
|
-
backend (Optional[str], optional): The backend to use. Defaults to "
|
|
90
|
+
backend (Optional[str], optional): The backend to use. Defaults to "folium".
|
|
91
91
|
**kwargs (Any): Additional keyword arguments.
|
|
92
92
|
|
|
93
93
|
Returns:
|
|
@@ -123,26 +123,39 @@ def view_raster(
|
|
|
123
123
|
if isinstance(source, dict):
|
|
124
124
|
source = dict_to_image(source)
|
|
125
125
|
|
|
126
|
-
if (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
126
|
+
if isinstance(source, str) and source.startswith("http"):
|
|
127
|
+
if backend == "folium":
|
|
128
|
+
|
|
129
|
+
m.add_geotiff(
|
|
130
|
+
url=source,
|
|
131
|
+
name=layer_name,
|
|
132
|
+
opacity=opacity,
|
|
133
|
+
attribution=attribution,
|
|
134
|
+
fit_bounds=zoom_to_layer,
|
|
135
|
+
palette=colormap,
|
|
136
|
+
vmin=vmin,
|
|
137
|
+
vmax=vmax,
|
|
138
|
+
**kwargs,
|
|
139
|
+
)
|
|
140
|
+
m.add_layer_control()
|
|
141
|
+
m.add_opacity_control()
|
|
142
|
+
|
|
143
|
+
else:
|
|
144
|
+
if indexes is not None:
|
|
145
|
+
kwargs["bidx"] = indexes
|
|
146
|
+
if colormap is not None:
|
|
147
|
+
kwargs["colormap_name"] = colormap
|
|
148
|
+
if attribution is None:
|
|
149
|
+
attribution = "TiTiler"
|
|
150
|
+
|
|
151
|
+
m.add_cog_layer(
|
|
152
|
+
source,
|
|
153
|
+
name=layer_name,
|
|
154
|
+
opacity=opacity,
|
|
155
|
+
attribution=attribution,
|
|
156
|
+
zoom_to_layer=zoom_to_layer,
|
|
157
|
+
**kwargs,
|
|
158
|
+
)
|
|
146
159
|
else:
|
|
147
160
|
m.add_raster(
|
|
148
161
|
source=source,
|
|
@@ -1081,8 +1094,9 @@ def view_vector(
|
|
|
1081
1094
|
|
|
1082
1095
|
def view_vector_interactive(
|
|
1083
1096
|
vector_data: Union[str, gpd.GeoDataFrame],
|
|
1084
|
-
layer_name: str = "Vector
|
|
1097
|
+
layer_name: str = "Vector",
|
|
1085
1098
|
tiles_args: Optional[Dict] = None,
|
|
1099
|
+
opacity: float = 0.7,
|
|
1086
1100
|
**kwargs: Any,
|
|
1087
1101
|
) -> Any:
|
|
1088
1102
|
"""
|
|
@@ -1097,6 +1111,7 @@ def view_vector_interactive(
|
|
|
1097
1111
|
layer_name (str, optional): The name of the layer. Defaults to "Vector Layer".
|
|
1098
1112
|
tiles_args (dict, optional): Additional arguments for the localtileserver client.
|
|
1099
1113
|
get_folium_tile_layer function. Defaults to None.
|
|
1114
|
+
opacity (float, optional): The opacity of the layer. Defaults to 0.7.
|
|
1100
1115
|
**kwargs: Additional keyword arguments to pass to GeoDataFrame.explore() function.
|
|
1101
1116
|
See https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.explore.html
|
|
1102
1117
|
|
|
@@ -1111,9 +1126,8 @@ def view_vector_interactive(
|
|
|
1111
1126
|
>>> roads = gpd.read_file("roads.shp")
|
|
1112
1127
|
>>> view_vector_interactive(roads, figsize=(12, 8))
|
|
1113
1128
|
"""
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
from leafmap import cog_tile
|
|
1129
|
+
|
|
1130
|
+
from leafmap.foliumap import Map
|
|
1117
1131
|
from localtileserver import TileClient, get_folium_tile_layer
|
|
1118
1132
|
|
|
1119
1133
|
google_tiles = {
|
|
@@ -1148,6 +1162,8 @@ def view_vector_interactive(
|
|
|
1148
1162
|
basemap_layer_name = None
|
|
1149
1163
|
raster_layer = None
|
|
1150
1164
|
|
|
1165
|
+
m = Map()
|
|
1166
|
+
|
|
1151
1167
|
if "tiles" in kwargs and isinstance(kwargs["tiles"], str):
|
|
1152
1168
|
if kwargs["tiles"].title() in google_tiles:
|
|
1153
1169
|
basemap_layer_name = google_tiles[kwargs["tiles"].title()]["name"]
|
|
@@ -1158,14 +1174,17 @@ def view_vector_interactive(
|
|
|
1158
1174
|
tiles_args = {}
|
|
1159
1175
|
if kwargs["tiles"].lower().startswith("http"):
|
|
1160
1176
|
basemap_layer_name = "Remote Raster"
|
|
1161
|
-
kwargs["tiles"] =
|
|
1162
|
-
kwargs["attr"] = "TiTiler"
|
|
1177
|
+
m.add_geotiff(kwargs["tiles"], name=basemap_layer_name, **tiles_args)
|
|
1163
1178
|
else:
|
|
1164
1179
|
basemap_layer_name = "Local Raster"
|
|
1165
1180
|
client = TileClient(kwargs["tiles"])
|
|
1166
1181
|
raster_layer = get_folium_tile_layer(client, **tiles_args)
|
|
1167
|
-
|
|
1168
|
-
|
|
1182
|
+
m.add_tile_layer(
|
|
1183
|
+
raster_layer.tiles,
|
|
1184
|
+
name=basemap_layer_name,
|
|
1185
|
+
attribution="localtileserver",
|
|
1186
|
+
**tiles_args,
|
|
1187
|
+
)
|
|
1169
1188
|
|
|
1170
1189
|
if "max_zoom" not in kwargs:
|
|
1171
1190
|
kwargs["max_zoom"] = 30
|
|
@@ -1180,23 +1199,18 @@ def view_vector_interactive(
|
|
|
1180
1199
|
if not isinstance(vector_data, gpd.GeoDataFrame):
|
|
1181
1200
|
raise TypeError("Input data must be a GeoDataFrame")
|
|
1182
1201
|
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1202
|
+
if "column" in kwargs:
|
|
1203
|
+
if "legend_position" not in kwargs:
|
|
1204
|
+
kwargs["legend_position"] = "bottomleft"
|
|
1205
|
+
if "cmap" not in kwargs:
|
|
1206
|
+
kwargs["cmap"] = "viridis"
|
|
1207
|
+
m.add_data(vector_data, layer_name=layer_name, opacity=opacity, **kwargs)
|
|
1187
1208
|
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
if isinstance(layer, folium.GeoJson):
|
|
1191
|
-
layer.layer_name = layer_name
|
|
1192
|
-
if isinstance(layer, folium.TileLayer) and basemap_layer_name:
|
|
1193
|
-
layer.layer_name = basemap_layer_name
|
|
1194
|
-
|
|
1195
|
-
if layer_control:
|
|
1196
|
-
m.add_child(folium.LayerControl())
|
|
1209
|
+
else:
|
|
1210
|
+
m.add_gdf(vector_data, layer_name=layer_name, opacity=opacity, **kwargs)
|
|
1197
1211
|
|
|
1198
|
-
|
|
1199
|
-
|
|
1212
|
+
m.add_layer_control()
|
|
1213
|
+
m.add_opacity_control()
|
|
1200
1214
|
|
|
1201
1215
|
return m
|
|
1202
1216
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: geoai-py
|
|
3
|
-
Version: 0.18.
|
|
3
|
+
Version: 0.18.1
|
|
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
|
|
@@ -24,7 +24,7 @@ Requires-Dist: ever-beta
|
|
|
24
24
|
Requires-Dist: geopandas
|
|
25
25
|
Requires-Dist: huggingface_hub
|
|
26
26
|
Requires-Dist: jupyter-server-proxy
|
|
27
|
-
Requires-Dist: leafmap
|
|
27
|
+
Requires-Dist: leafmap>=0.57.1
|
|
28
28
|
Requires-Dist: localtileserver
|
|
29
29
|
Requires-Dist: mapclassify
|
|
30
30
|
Requires-Dist: maplibre
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
geoai/__init__.py,sha256=
|
|
1
|
+
geoai/__init__.py,sha256=qnoCW0NfvimhNEbdskac4m4FG7ijlWb_Hy_3j4Hi4tw,4620
|
|
2
2
|
geoai/change_detection.py,sha256=pdQofnPRiwoES8vMln2vHghRnpeTdsmqLir74dnqZYU,60389
|
|
3
3
|
geoai/classify.py,sha256=0DcComVR6vKU4qWtH2oHVeXc7ZTcV0mFvdXRtlNmolo,35637
|
|
4
4
|
geoai/detectron2.py,sha256=dOOFM9M9-6PV8q2A4-mnIPrz7yTo-MpEvDiAW34nl0w,14610
|
|
@@ -14,7 +14,7 @@ geoai/segmentation.py,sha256=7yEzBSKCyHW1dNssoK0rdvhxi2IXsIQIFSga817KdI4,11535
|
|
|
14
14
|
geoai/timm_segment.py,sha256=GfvWmxT6t1S99-iZOf8PlsCkwodIUyrt0AwO_j6dCjE,38470
|
|
15
15
|
geoai/timm_train.py,sha256=y_Sm9Fwe7bTsHEKdtPee5rGY7s01CbkAZKP1TwUDXlU,20551
|
|
16
16
|
geoai/train.py,sha256=Ef-lCCQvaMWl3wvhi-IYYi9sdR4YBqMt9QkfiRAUlkQ,174762
|
|
17
|
-
geoai/utils.py,sha256=
|
|
17
|
+
geoai/utils.py,sha256=tSbB_05ScAB9ZG2ART9OAvHUv4UtfDzNElPK6gGWftc,360678
|
|
18
18
|
geoai/agents/__init__.py,sha256=5xtb_dGpI26nPFcAm8Dj7O4bLskqr1xTw2BRQqbgH4w,285
|
|
19
19
|
geoai/agents/catalog_models.py,sha256=19E-PiE7FvpGEiOi4gDMKPf257FOhLseuVGWJbOjrDs,2089
|
|
20
20
|
geoai/agents/catalog_tools.py,sha256=psVw7-di65hhnJUFqWXFoOkbGaG2_sHrQhA5vdXp3x4,33597
|
|
@@ -25,9 +25,9 @@ geoai/agents/stac_tools.py,sha256=ILUg2xFRXVZ9WHOfPeJBvPSFT7lRsPLnGMZhnpDZ1co,16
|
|
|
25
25
|
geoai/tools/__init__.py,sha256=McC49tQjxrTha1TS69IeM3rRvqVQP3H1NdAZPZPpKEI,1683
|
|
26
26
|
geoai/tools/cloudmask.py,sha256=qzvqVa8FAEgd8mePXBaV5Ptx4fHhwfS1BsYL0JAZBjM,14500
|
|
27
27
|
geoai/tools/multiclean.py,sha256=TVwmWgeQyGIyUuCe10b6pGCtgIl8TkZmcgVXPimn9uM,11949
|
|
28
|
-
geoai_py-0.18.
|
|
29
|
-
geoai_py-0.18.
|
|
30
|
-
geoai_py-0.18.
|
|
31
|
-
geoai_py-0.18.
|
|
32
|
-
geoai_py-0.18.
|
|
33
|
-
geoai_py-0.18.
|
|
28
|
+
geoai_py-0.18.1.dist-info/licenses/LICENSE,sha256=TlBm8mRusRVB9yF2NTg-STcb71v69-XZaKaPdshqP2I,1074
|
|
29
|
+
geoai_py-0.18.1.dist-info/METADATA,sha256=Q-zRXESB9250UYYvOZyIroIDqzK60XNQjR_feCTmXig,11263
|
|
30
|
+
geoai_py-0.18.1.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
|
|
31
|
+
geoai_py-0.18.1.dist-info/entry_points.txt,sha256=uGp3Az3HURIsRHP9v-ys0hIbUuBBNUfXv6VbYHIXeg4,41
|
|
32
|
+
geoai_py-0.18.1.dist-info/top_level.txt,sha256=1YkCUWu-ii-0qIex7kbwAvfei-gos9ycyDyUCJPNWHY,6
|
|
33
|
+
geoai_py-0.18.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|