geobox 2.1.0__py3-none-any.whl → 2.2.1__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.
Files changed (70) hide show
  1. geobox/__init__.py +61 -63
  2. geobox/aio/__init__.py +61 -63
  3. geobox/aio/api.py +491 -574
  4. geobox/aio/apikey.py +263 -263
  5. geobox/aio/attachment.py +341 -339
  6. geobox/aio/base.py +261 -262
  7. geobox/aio/basemap.py +196 -196
  8. geobox/aio/dashboard.py +340 -342
  9. geobox/aio/feature.py +35 -35
  10. geobox/aio/field.py +315 -321
  11. geobox/aio/file.py +72 -72
  12. geobox/aio/layout.py +340 -341
  13. geobox/aio/log.py +23 -23
  14. geobox/aio/map.py +1033 -1034
  15. geobox/aio/model3d.py +415 -415
  16. geobox/aio/mosaic.py +696 -696
  17. geobox/aio/plan.py +314 -314
  18. geobox/aio/query.py +693 -693
  19. geobox/aio/raster.py +88 -454
  20. geobox/aio/{analysis.py → raster_analysis.py} +153 -170
  21. geobox/aio/route.py +4 -4
  22. geobox/aio/scene.py +340 -342
  23. geobox/aio/settings.py +18 -18
  24. geobox/aio/task.py +404 -402
  25. geobox/aio/tile3d.py +337 -339
  26. geobox/aio/tileset.py +102 -103
  27. geobox/aio/usage.py +52 -51
  28. geobox/aio/user.py +506 -507
  29. geobox/aio/vector_tool.py +1968 -0
  30. geobox/aio/vectorlayer.py +316 -414
  31. geobox/aio/version.py +272 -273
  32. geobox/aio/view.py +1019 -983
  33. geobox/aio/workflow.py +340 -341
  34. geobox/api.py +14 -98
  35. geobox/apikey.py +262 -262
  36. geobox/attachment.py +336 -337
  37. geobox/base.py +384 -384
  38. geobox/basemap.py +194 -194
  39. geobox/dashboard.py +339 -341
  40. geobox/enums.py +31 -1
  41. geobox/feature.py +31 -10
  42. geobox/field.py +320 -320
  43. geobox/file.py +4 -4
  44. geobox/layout.py +339 -340
  45. geobox/log.py +4 -4
  46. geobox/map.py +1031 -1032
  47. geobox/model3d.py +410 -410
  48. geobox/mosaic.py +696 -696
  49. geobox/plan.py +313 -313
  50. geobox/query.py +691 -691
  51. geobox/raster.py +5 -368
  52. geobox/{analysis.py → raster_analysis.py} +108 -128
  53. geobox/scene.py +341 -342
  54. geobox/settings.py +194 -194
  55. geobox/task.py +399 -400
  56. geobox/tile3d.py +337 -338
  57. geobox/tileset.py +4 -4
  58. geobox/usage.py +3 -3
  59. geobox/user.py +503 -503
  60. geobox/vector_tool.py +1968 -0
  61. geobox/vectorlayer.py +5 -110
  62. geobox/version.py +272 -272
  63. geobox/view.py +981 -981
  64. geobox/workflow.py +338 -339
  65. {geobox-2.1.0.dist-info → geobox-2.2.1.dist-info}/METADATA +15 -1
  66. geobox-2.2.1.dist-info/RECORD +72 -0
  67. geobox-2.1.0.dist-info/RECORD +0 -70
  68. {geobox-2.1.0.dist-info → geobox-2.2.1.dist-info}/WHEEL +0 -0
  69. {geobox-2.1.0.dist-info → geobox-2.2.1.dist-info}/licenses/LICENSE +0 -0
  70. {geobox-2.1.0.dist-info → geobox-2.2.1.dist-info}/top_level.txt +0 -0
geobox/aio/raster.py CHANGED
@@ -1,32 +1,29 @@
1
1
  import os
2
- from urllib.parse import urljoin, urlencode
3
- from typing import Optional, Dict, List, Optional, Union, TYPE_CHECKING
4
2
  import mimetypes
5
3
  import requests
6
4
  import sys
5
+ from urllib.parse import urljoin, urlencode
6
+ from typing import Optional, Dict, List, Optional, Union, TYPE_CHECKING
7
7
 
8
8
  from .base import AsyncBase
9
- from .task import Task
10
- from .vectorlayer import VectorLayer
11
- from .view import VectorLayerView
9
+ from .task import AsyncTask
12
10
  from ..utils import clean_data, join_url_params
13
- from ..enums import PolygonizeConnectivity, AnalysisResampleMethod, SlopeUnit, AnalysisAlgorithm, AnalysisDataType, RangeBound, DistanceUnit
14
11
 
15
12
  if TYPE_CHECKING:
16
13
  from . import AsyncGeoboxClient
17
- from .user import User
18
- from ..api import GeoboxClient as SyncGeoboxClient
19
- from ..raster import Raster as SyncRaster
14
+ from .user import AsyncUser
15
+ from ..api import GeoboxClient
16
+ from ..raster import Raster
20
17
 
21
18
 
22
- class Raster(AsyncBase):
19
+ class AsyncRaster(AsyncBase):
23
20
 
24
21
  BASE_ENDPOINT: str = 'rasters/'
25
22
 
26
23
  def __init__(self,
27
- api: 'AsyncGeoboxClient',
28
- uuid: str,
29
- data: Optional[Dict] = {}):
24
+ api: 'AsyncGeoboxClient',
25
+ uuid: str,
26
+ data: Optional[Dict] = {}):
30
27
  """
31
28
  Constructs all the necessary attributes for the Raster object.
32
29
 
@@ -39,7 +36,7 @@ class Raster(AsyncBase):
39
36
 
40
37
 
41
38
  @classmethod
42
- async def get_rasters(cls, api: 'AsyncGeoboxClient', **kwargs) -> Union[List['Raster'], int]:
39
+ async def get_rasters(cls, api: 'AsyncGeoboxClient', **kwargs) -> Union[List['AsyncRaster'], int]:
43
40
  """
44
41
  [async] Get all rasters.
45
42
 
@@ -59,13 +56,13 @@ class Raster(AsyncBase):
59
56
  shared (bool): whether to return shared rasters. default is False.
60
57
 
61
58
  Returns:
62
- List[Raster] | int: A list of Raster objects or the total count of rasters.
59
+ List[AsyncRaster] | int: A list of Raster objects or the total count of rasters.
63
60
 
64
61
  Example:
65
62
  >>> from geobox.aio import AsyncGeoboxClient
66
- >>> from geobox.aio.raster import Raster
63
+ >>> from geobox.aio.raster import AsyncRaster
67
64
  >>> async with AsyncGeoboxClient() as client:
68
- >>> rasters = await Raster.get_rasters(client, terrain=True, q="name LIKE '%GIS%'")
65
+ >>> rasters = await AsyncRaster.get_rasters(client, terrain=True, q="name LIKE '%GIS%'")
69
66
  or
70
67
  >>> rasters = await client.get_rasters(terrain=True, q="name LIKE '%GIS%'")
71
68
  """
@@ -82,12 +79,12 @@ class Raster(AsyncBase):
82
79
  'user_id': kwargs.get('user_id', None),
83
80
  'shared': kwargs.get('shared', False)
84
81
  }
85
- return await super()._get_list(api, cls.BASE_ENDPOINT, params, factory_func=lambda api, item: Raster(api, item['uuid'], item))
82
+ return await super()._get_list(api, cls.BASE_ENDPOINT, params, factory_func=lambda api, item: AsyncRaster(api, item['uuid'], item))
86
83
 
87
84
 
88
85
 
89
86
  @classmethod
90
- async def get_rasters_by_ids(cls, api: 'AsyncGeoboxClient', ids: List[str], user_id: int = None) -> List['Raster']:
87
+ async def get_rasters_by_ids(cls, api: 'AsyncGeoboxClient', ids: List[str], user_id: int = None) -> List['AsyncRaster']:
91
88
  """
92
89
  [async] Get rasters by their IDs.
93
90
 
@@ -97,13 +94,13 @@ class Raster(AsyncBase):
97
94
  user_id (int, optional): specific user. privileges required.
98
95
 
99
96
  Returns:
100
- List['Raster']: A list of Raster objects.
97
+ List['AsyncRaster']: A list of Raster objects.
101
98
 
102
99
  Example:
103
100
  >>> from geobox.aio import AsyncGeoboxClient
104
- >>> from geobox.aio.raster import Raster
101
+ >>> from geobox.aio.raster import AsyncRaster
105
102
  >>> async with AsyncGeoboxClient() as client:
106
- >>> rasters = await Raster.get_rasters_by_ids(client, ids=['123', '456'])
103
+ >>> rasters = await AsyncRaster.get_rasters_by_ids(client, ids=['123', '456'])
107
104
  or
108
105
  >>> rasters = await client.get_rasters_by_ids(ids=['123', '456'])
109
106
  """
@@ -113,11 +110,11 @@ class Raster(AsyncBase):
113
110
  }
114
111
  endpoint = urljoin(cls.BASE_ENDPOINT, 'get-rasters/')
115
112
 
116
- return await super()._get_list_by_ids(api, endpoint, params, factory_func=lambda api, item: Raster(api, item['uuid'], item))
113
+ return await super()._get_list_by_ids(api, endpoint, params, factory_func=lambda api, item: AsyncRaster(api, item['uuid'], item))
117
114
 
118
115
 
119
116
  @classmethod
120
- async def get_raster(cls, api: 'AsyncGeoboxClient', uuid: str, user_id: int = None) -> 'Raster':
117
+ async def get_raster(cls, api: 'AsyncGeoboxClient', uuid: str, user_id: int = None) -> 'AsyncRaster':
121
118
  """
122
119
  [async] Get a raster by its UUID.
123
120
 
@@ -127,13 +124,13 @@ class Raster(AsyncBase):
127
124
  user_id (int, optional): specific user. privileges required.
128
125
 
129
126
  Returns:
130
- Raster: A Raster object.
127
+ AsyncRaster: A Raster object.
131
128
 
132
129
  Example:
133
130
  >>> from geobox.aio import AsyncGeoboxClient
134
- >>> from geobox.aio.raster import Raster
131
+ >>> from geobox.aio.raster import AsyncRaster
135
132
  >>> async with AsyncGeoboxClient() as client:
136
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
133
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
137
134
  or
138
135
  >>> raster = await client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
139
136
  """
@@ -141,11 +138,11 @@ class Raster(AsyncBase):
141
138
  'f': 'json',
142
139
  'user_id': user_id
143
140
  }
144
- return await super()._get_detail(api, cls.BASE_ENDPOINT, uuid, params, factory_func=lambda api, item: Raster(api, item['uuid'], item))
141
+ return await super()._get_detail(api, cls.BASE_ENDPOINT, uuid, params, factory_func=lambda api, item: AsyncRaster(api, item['uuid'], item))
145
142
 
146
143
 
147
144
  @classmethod
148
- async def get_raster_by_name(cls, api: 'AsyncGeoboxClient', name: str, user_id: int = None) -> Union['Raster', None]:
145
+ async def get_raster_by_name(cls, api: 'AsyncGeoboxClient', name: str, user_id: int = None) -> Union['AsyncRaster', None]:
149
146
  """
150
147
  [async] Get a raster by name
151
148
 
@@ -155,13 +152,13 @@ class Raster(AsyncBase):
155
152
  user_id (int, optional): specific user. privileges required.
156
153
 
157
154
  Returns:
158
- Raster | None: returns the raster if a raster matches the given name, else None
155
+ AsyncRaster | None: returns the raster if a raster matches the given name, else None
159
156
 
160
157
  Example:
161
158
  >>> from geobox.aio import AsyncGeoboxClient
162
- >>> from geobox.aio.raster import Raster
159
+ >>> from geobox.aio.raster import AsyncRaster
163
160
  >>> async with AsyncGeoboxClient() as client:
164
- >>> raster = await Raster.get_raster_by_name(client, name='test')
161
+ >>> raster = await AsyncRaster.get_raster_by_name(client, name='test')
165
162
  or
166
163
  >>> raster = await client.get_raster_by_name(name='test')
167
164
  """
@@ -186,9 +183,9 @@ class Raster(AsyncBase):
186
183
 
187
184
  Example:
188
185
  >>> from geobox.aio import AsyncGeoboxClient
189
- >>> from geobox.aio.raster import Raster
186
+ >>> from geobox.aio.raster import AsyncRaster
190
187
  >>> async with AsyncGeoboxClient() as client:
191
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
188
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
192
189
  >>> await raster.update(name="new_name")
193
190
  """
194
191
  params = {
@@ -208,12 +205,12 @@ class Raster(AsyncBase):
208
205
 
209
206
  Example:
210
207
  >>> from geobox.aio import AsyncGeoboxClient
211
- >>> from geobox.aio.raster import Raster
208
+ >>> from geobox.aio.raster import AsyncRaster
212
209
  >>> async with AsyncGeoboxClient() as client:
213
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
210
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
214
211
  >>> await raster.delete()
215
212
  """
216
- await super().delete(self.endpoint)
213
+ await super()._delete(self.endpoint)
217
214
 
218
215
 
219
216
  @property
@@ -226,12 +223,12 @@ class Raster(AsyncBase):
226
223
 
227
224
  Example:
228
225
  >>> from geobox.aio import AsyncGeoboxClient
229
- >>> from geobox.aio.raster import Raster
226
+ >>> from geobox.aio.raster import AsyncRaster
230
227
  >>> async with AsyncGeoboxClient() as client:
231
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
228
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
232
229
  >>> raster.thumbnail
233
230
  """
234
- return super().thumbnail(format='')
231
+ return super()._thumbnail(format='')
235
232
 
236
233
 
237
234
  @property
@@ -244,9 +241,9 @@ class Raster(AsyncBase):
244
241
 
245
242
  Example:
246
243
  >>> from geobox.aio import AsyncGeoboxClient
247
- >>> from geobox.aio.raster import Raster
244
+ >>> from geobox.aio.raster import AsyncRaster
248
245
  >>> async with AsyncGeoboxClient() as client:
249
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
246
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
250
247
  >>> await raster.info
251
248
  """
252
249
  endpoint = urljoin(self.endpoint, 'info/')
@@ -265,9 +262,9 @@ class Raster(AsyncBase):
265
262
 
266
263
  Example:
267
264
  >>> from geobox.aio import AsyncGeoboxClient
268
- >>> from geobox.aio.raster import Raster
265
+ >>> from geobox.aio.raster import AsyncRaster
269
266
  >>> async with AsyncGeoboxClient() as client:
270
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
267
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
271
268
  >>> await raster.get_statistics(indexes='1, 2, 3')
272
269
  """
273
270
  params = clean_data({
@@ -291,9 +288,9 @@ class Raster(AsyncBase):
291
288
 
292
289
  Example:
293
290
  >>> from geobox.aio import AsyncGeoboxClient
294
- >>> from geobox.aio.raster import Raster
291
+ >>> from geobox.aio.raster import AsyncRaster
295
292
  >>> async with AsyncGeoboxClient() as client:
296
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
293
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
297
294
  >>> await raster.get_point(lat=60, lng=50)
298
295
  """
299
296
  if lat < -90 or lat > 90:
@@ -392,9 +389,9 @@ class Raster(AsyncBase):
392
389
 
393
390
  Example:
394
391
  >>> from geobox.aio import AsyncGeoboxClient
395
- >>> from geobox.aio.raster import Raster
392
+ >>> from geobox.aio.raster import AsyncRaster
396
393
  >>> async with AsyncGeoboxClient() as client:
397
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
394
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
398
395
  >>> await raster.download(save_path="path/to/save/")
399
396
  """
400
397
  if not self.uuid:
@@ -440,9 +437,9 @@ class Raster(AsyncBase):
440
437
 
441
438
  Examples:
442
439
  >>> from geobox.aio import AsyncGeoboxClient
443
- >>> from geobox.aio.raster import Raster
440
+ >>> from geobox.aio.raster import AsyncRaster
444
441
  >>> async with AsyncGeoboxClient() as client:
445
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
442
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
446
443
  >>> raster_tiff = await raste.get_content_file()
447
444
  """
448
445
  if not self.uuid:
@@ -492,9 +489,9 @@ class Raster(AsyncBase):
492
489
 
493
490
  Example:
494
491
  >>> from geobox.aio import AsyncGeoboxClient
495
- >>> from geobox.aio.raster import Raster
492
+ >>> from geobox.aio.raster import AsyncRaster
496
493
  >>> async with AsyncGeoboxClient() as client:
497
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
494
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
498
495
  >>> raster.get_tile_render_url(x=10, y=20, z=1)
499
496
  """
500
497
  params = clean_data({
@@ -532,9 +529,9 @@ class Raster(AsyncBase):
532
529
 
533
530
  Example:
534
531
  >>> from geobox.aio import AsyncGeoboxClient
535
- >>> from geobox.aio.raster import Raster
532
+ >>> from geobox.aio.raster import AsyncRaster
536
533
  >>> async with AsyncGeoboxClient() as client:
537
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
534
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
538
535
  >>> raster.get_tile_pbf_url(x=10, y=20, z=1)
539
536
  """
540
537
  params = clean_data({
@@ -564,9 +561,9 @@ class Raster(AsyncBase):
564
561
 
565
562
  Example:
566
563
  >>> from geobox.aio import AsyncGeoboxClient
567
- >>> from geobox.aio.raster import Raster
564
+ >>> from geobox.aio.raster import AsyncRaster
568
565
  >>> async with AsyncGeoboxClient() as client:
569
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
566
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
570
567
  >>> raster.get_tile_png_url(x=10, y=20, z=1)
571
568
  """
572
569
  endpoint = f'{self.api.base_url}{self.endpoint}tiles/{z}/{x}/{y}.png'
@@ -586,9 +583,9 @@ class Raster(AsyncBase):
586
583
 
587
584
  Example:
588
585
  >>> from geobox.aio import AsyncGeoboxClient
589
- >>> from geobox.aio.raster import Raster
586
+ >>> from geobox.aio.raster import AsyncRaster
590
587
  >>> async with AsyncGeoboxClient() as client:
591
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
588
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
592
589
  >>> await raster.get_tile_json()
593
590
  """
594
591
  endpoint = urljoin(self.endpoint, 'tilejson.json')
@@ -607,9 +604,9 @@ class Raster(AsyncBase):
607
604
 
608
605
  Example:
609
606
  >>> from geobox.aio import AsyncGeoboxClient
610
- >>> from geobox.aio.raster import Raster
607
+ >>> from geobox.aio.raster import AsyncRaster
611
608
  >>> async with AsyncGeoboxClient() as client:
612
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
609
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
613
610
  >>> raster.wmts(scale=1)
614
611
  """
615
612
  endpoint = urljoin(self.api.base_url, f'{self.endpoint}wmts/')
@@ -632,9 +629,9 @@ class Raster(AsyncBase):
632
629
 
633
630
  Example:
634
631
  >>> from geobox.aio import AsyncGeoboxClient
635
- >>> from geobox.aio.raster import Raster
632
+ >>> from geobox.aio.raster import AsyncRaster
636
633
  >>> async with AsyncGeoboxClient() as client:
637
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
634
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
638
635
  >>> await raster.settings
639
636
  """
640
637
  return await super()._get_settings(self.endpoint)
@@ -679,9 +676,9 @@ class Raster(AsyncBase):
679
676
 
680
677
  Example:
681
678
  >>> from geobox.aio import AsyncGeoboxClient
682
- >>> from geobox.aio.raster import Raster
679
+ >>> from geobox.aio.raster import AsyncRaster
683
680
  >>> async with AsyncGeoboxClient() as client:
684
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
681
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
685
682
  >>> await raster.set_settings(nodata=0,
686
683
  ... indexes=[1],
687
684
  ... rescale=[[0, 10000]],
@@ -714,49 +711,49 @@ class Raster(AsyncBase):
714
711
  return await super()._set_settings(self.endpoint, settings)
715
712
 
716
713
 
717
- async def share(self, users: List['User']) -> None:
714
+ async def share(self, users: List['AsyncUser']) -> None:
718
715
  """
719
716
  [async] Shares the raster with specified users.
720
717
 
721
718
  Args:
722
- users (List[User]): The list of user objects to share the raster with.
719
+ users (List[AsyncUser]): The list of user objects to share the raster with.
723
720
 
724
721
  Returns:
725
722
  None
726
723
 
727
724
  Example:
728
725
  >>> from geobox.aio import AsyncGeoboxClient
729
- >>> from geobox.aio.raster import Raster
726
+ >>> from geobox.aio.raster import AsyncRaster
730
727
  >>> async with AsyncGeoboxClient() as client:
731
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
728
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
732
729
  >>> users = await client.search_users(search="John")
733
730
  >>> await raster.share(users=users)
734
731
  """
735
732
  await super()._share(self.endpoint, users)
736
733
 
737
734
 
738
- async def unshare(self, users: List['User']) -> None:
735
+ async def unshare(self, users: List['AsyncUser']) -> None:
739
736
  """
740
737
  [async] Unshares the raster with specified users.
741
738
 
742
739
  Args:
743
- users (List[User]): The list of user objects to unshare the raster with.
740
+ users (List[AsyncUser]): The list of user objects to unshare the raster with.
744
741
 
745
742
  Returns:
746
743
  None
747
744
 
748
745
  Example:
749
746
  >>> from geobox.aio import AsyncGeoboxClient
750
- >>> from geobox.aio.raster import Raster
747
+ >>> from geobox.aio.raster import AsyncRaster
751
748
  >>> async with AsyncGeoboxClient() as client:
752
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
749
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
753
750
  >>> users = await client.search_users(search="John")
754
751
  >>> await raster.unshare(users=users)
755
752
  """
756
753
  await super()._unshare(self.endpoint, users)
757
754
 
758
755
 
759
- async def get_shared_users(self, search: str = None, skip: int = 0, limit: int = 10) -> List['User']:
756
+ async def get_shared_users(self, search: str = None, skip: int = 0, limit: int = 10) -> List['AsyncUser']:
760
757
  """
761
758
  [async] Retrieves the list of users the raster is shared with.
762
759
 
@@ -766,13 +763,13 @@ class Raster(AsyncBase):
766
763
  limit (int, optional): The maximum number of users to retrieve.
767
764
 
768
765
  Returns:
769
- List[User]: The list of shared users.
766
+ List[AsyncUser]: The list of shared users.
770
767
 
771
768
  Example:
772
769
  >>> from geobox.aio import AsyncGeoboxClient
773
- >>> from geobox.aio.raster import Raster
770
+ >>> from geobox.aio.raster import AsyncRaster
774
771
  >>> async with AsyncGeoboxClient() as client:
775
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
772
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
776
773
  >>> await raster.get_shared_users(search='John', skip=0, limit=10)
777
774
  """
778
775
  params = {
@@ -783,7 +780,7 @@ class Raster(AsyncBase):
783
780
  return await super()._get_shared_users(self.endpoint, params)
784
781
 
785
782
 
786
- async def seed_cache(self, from_zoom: int = None, to_zoom: int = None, extent: List[int] = None, workers: int = 1) -> List['Task']:
783
+ async def seed_cache(self, from_zoom: int = None, to_zoom: int = None, extent: List[int] = None, workers: int = 1) -> List['AsyncTask']:
787
784
  """
788
785
  [async] Seed the cache of the raster.
789
786
 
@@ -794,13 +791,13 @@ class Raster(AsyncBase):
794
791
  workers (int, optional): The number of workers to use. default is 1.
795
792
 
796
793
  Returns:
797
- Task: The task of the seed cache.
794
+ AsyncTask: The task of the seed cache.
798
795
 
799
796
  Example:
800
797
  >>> from geobox.aio import AsyncGeoboxClient
801
- >>> from geobox.aio.raster import Raster
798
+ >>> from geobox.aio.raster import AsyncRaster
802
799
  >>> async with AsyncGeoboxClient() as client:
803
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
800
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
804
801
  >>> task = await raster.seed_cache(from_zoom=0, to_zoom=22, extent=[0, 0, 100, 100], workers=1)
805
802
  """
806
803
  data = {
@@ -821,9 +818,9 @@ class Raster(AsyncBase):
821
818
 
822
819
  Example:
823
820
  >>> from geobox.aio import AsyncGeoboxClient
824
- >>> from geobox.aio.raster import Raster
821
+ >>> from geobox.aio.raster import AsyncRaster
825
822
  >>> async with AsyncGeoboxClient() as client:
826
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
823
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
827
824
  >>> await raster.clear_cache()
828
825
  """
829
826
  await super()._clear_cache(self.endpoint)
@@ -839,399 +836,36 @@ class Raster(AsyncBase):
839
836
 
840
837
  Example:
841
838
  >>> from geobox.aio import AsyncGeoboxClient
842
- >>> from geobox.aio.raster import Raster
839
+ >>> from geobox.aio.raster import AsyncRaster
843
840
  >>> async with AsyncGeoboxClient() as client:
844
- >>> raster = await Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
841
+ >>> raster = await AsyncRaster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
845
842
  >>> await raster.cache_size
846
843
  """
847
844
  return await super()._cache_size(self.endpoint)
848
845
 
849
846
 
850
- def to_sync(self, sync_client: 'SyncGeoboxClient') -> 'SyncRaster':
847
+ def to_sync(self, sync_client: 'GeoboxClient') -> 'Raster':
851
848
  """
852
849
  Switch to sync version of the raster instance to have access to the sync methods
853
850
 
854
851
  Args:
855
- sync_client (SyncGeoboxClient): The sync version of the GeoboxClient instance for making requests.
852
+ sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
856
853
 
857
854
  Returns:
858
- geobox.raster.Raster: the sync instance of the raster.
855
+ Raster: the sync instance of the raster.
859
856
 
860
857
  Example:
861
858
  >>> from geobox import Geoboxclient
862
859
  >>> from geobox.aio import AsyncGeoboxClient
863
- >>> from geobox.aio.raster import Raster
860
+ >>> from geobox.aio.raster import AsyncRaster
864
861
  >>> client = GeoboxClient()
865
862
  >>> async with AsyncGeoboxClient() as async_client:
866
- >>> raster = await Raster.get_raster(async_client, uuid="12345678-1234-5678-1234-567812345678")
863
+ >>> raster = await AsyncRaster.get_raster(async_client, uuid="12345678-1234-5678-1234-567812345678")
867
864
  >>> sync_raster = raster.to_sync(client)
868
865
  """
869
- from ..raster import Raster as SyncRaster
870
-
871
- return SyncRaster(api=sync_client, uuid=self.uuid, data=self.data)
872
-
873
-
874
- async def polygonize(self,
875
- output_layer_name: str,
876
- band_index: int = 1,
877
- value_field: Optional[str] = None,
878
- mask_nodata: bool = False,
879
- connectivity: PolygonizeConnectivity = PolygonizeConnectivity.connected_4,
880
- keep_values: Optional[str] = None,
881
- layer_name: Optional[str] = None,
882
- user_id: Optional[int] = None) -> 'Task':
883
- """
884
- [async] Convert a raster to vector polygons
885
-
886
- vectorizes a raster (polygonize) to a vector dataset (*.gpkg). Only users with Publisher role or higher can perform this operation
887
-
888
- Args:
889
- api (GeoboxClient): The GeoboxClient instance for making requests
890
- raster (Raster): Raster instance
891
- output_layer_name (str): Name for the output vector layer.
892
- band_index (int, optional): Raster band to polygonize. default: 1
893
- value_field (str, optional): Name of attribute field storing the pixel value. default: None
894
- mask_nodata (bool, optional): If True, NoData pixels are excluded using the band mask. default: False
895
- connectivity (PolygonizeConnectivity, optional): 4 or 8 connectivity for region grouping. default: PolygonizeConnectivity.connected_4
896
- keep_values (str, optional): JSON array of values to keep (e.g., '[1,2,3]'). default: None
897
- layer_name (str, optional): Output layer name. default: None
898
- user_id (int, optional): specific user. priviledges required!
899
-
900
- Returns:
901
- Task: task instance of the process
902
-
903
- Example:
904
- >>> from geobox.aio import AsyncGeoboxClient
905
- >>> async with AsyncGeoboxClient() as client:
906
- >>> raster = await client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
907
- >>> task = raster.polygonize(output_layer_name='test')
908
- """
909
- from .analysis import Analysis
910
- return await Analysis.polygonize(self.api,
911
- self,
912
- output_layer_name=output_layer_name,
913
- band_index=band_index,
914
- value_field=value_field,
915
- mask_nodata=mask_nodata,
916
- connectivity=connectivity,
917
- keep_values=keep_values,
918
- layer_name=layer_name,
919
- user_id=user_id)
920
-
921
-
922
- async def clip(self,
923
- layer: Union[VectorLayer, VectorLayerView],
924
- output_raster_name: str,
925
- where: Optional[str] = None,
926
- dst_nodata: int = -9999,
927
- crop: bool = True,
928
- resample: AnalysisResampleMethod = AnalysisResampleMethod.near,
929
- user_id: Optional[int] = None) -> 'Task':
930
- """
931
- [async] Clip a raster using a vector layer as a mask
932
-
933
- clips a raster dataset using a vector layer as the clipping boundary. Only users with Publisher role or higher can perform this operation
934
-
935
- Args:
936
- api (GeoboxClient): The GeoboxClient instance for making requests
937
- raster (Raster): Raster instance
938
- layer (VectorLayer | VectorLayerView): VectorLayer or VectorLayerView instance
939
- output_raster_name (str): Name for the output raster dataset
940
- where (str, optional): Optional attribute filter, e.g. 'VEG=forest'.
941
- dst_nodata (int, optional): Output NoData value. default: -9999
942
- crop (bool, optional): True=shrink extent to polygon(s); False=keep full extent but mask outside. default: True
943
- resample (AnalysisResampleMethod, optional): Resampling method: 'near', 'bilinear', 'cubic', 'lanczos', etc. default: AnalysisResampleMethod.near
944
- user_id (int, optional): specific user. priviledges required!
945
-
946
- Returns:
947
- Task: task instance of the process
948
-
949
- Example:
950
- >>> from geobox.aio import AsyncGeoboxClient
951
- >>> async with AsyncGeoboxClient() as client:
952
- >>> raster = await client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
953
- >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
954
- >>> await raster.clip(layer=vector, output_raster_name='test')
955
- """
956
- from .analysis import Analysis
957
- return await Analysis.clip(self.api,
958
- self,
959
- layer=layer,
960
- output_raster_name=output_raster_name,
961
- where=where,
962
- dst_nodata=dst_nodata,
963
- crop=crop,
964
- resample=resample,
965
- user_id=user_id)
966
-
967
-
968
- async def slope(self,
969
- output_raster_name: str,
970
- slope_units: SlopeUnit = SlopeUnit.degree,
971
- algorithm: AnalysisAlgorithm = AnalysisAlgorithm.Horn,
972
- scale: int = 1,
973
- compute_edges: bool = True,
974
- nodata_out: int = -9999,
975
- user_id: Optional[int] = None) -> 'Task':
976
- """
977
- [async] Calculate slope from a DEM raster.
978
-
979
- This endpoint creates a slope raster from a Digital Elevation Model (DEM). Only users with Publisher role or higher can perform this operation.
980
-
981
- Args:
982
- output_raster_name (str): Name for the output raster dataset.
983
- slope_units (SlopeUnit, optional): Slope units: 'degree' or 'percent'. default: SlopeUnit.degree
984
- algorithm (AnalysisAlgorithm, optional): Algorithm: 'Horn' or 'ZevenbergenThorne'. default: AnalysisAlgorithm.Horn
985
- scale (int, optional): Ratio of vertical units to horizontal units. default: 1
986
- compute_edges (bool, optional): Whether to compute edges. default: True
987
- nodata (int, optional): NoData value for the output raster. default = -9999
988
- user_id (int, optional): specific user. priviledges required!
989
-
990
- Returns:
991
- Task: task instance of the process
992
-
993
- Example:
994
- >>> from geobox.aio import AsyncGeoboxClient
995
- >>> async with AsyncGeoboxClient() as client:
996
- >>> raster = await client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
997
- >>> task = await raster.slope(output_raster_name='test')
998
- """
999
- from .analysis import Analysis
1000
- return await Analysis.slope(self.api,
1001
- self,
1002
- slope_units=slope_units,
1003
- output_raster_name=output_raster_name,
1004
- algorithm=algorithm,
1005
- scale=scale,
1006
- compute_edges=compute_edges,
1007
- nodata_out=nodata_out,
1008
- user_id=user_id)
1009
-
1010
-
1011
- async def aspect(self,
1012
- output_raster_name: str,
1013
- algorithm: AnalysisAlgorithm = AnalysisAlgorithm.Horn,
1014
- trigonometric: bool = False,
1015
- zero_for_flat: bool = True,
1016
- compute_edges: bool = True,
1017
- nodata_out: int = -9999,
1018
- user_id: Optional[int] = None) -> 'Task':
1019
- """
1020
- [async] Calculate aspect from a DEM raster.
1021
-
1022
- it creates an aspect raster (degrees 0–360) from a Digital Elevation Model (DEM).
1023
- Only users with Publisher role or higher can perform this operation.
1024
-
1025
- Args:
1026
- api (GeoboxClient): The GeoboxClient instance for making requests
1027
- raster (Raster): DEM Raster instance
1028
- output_raster_name (str): Name for the output raster dataset.
1029
- algorithm (AnalysisAlgorithm, optional): Algorithm: 'Horn' or 'ZevenbergenThorne'. default: AnalysisAlgorithm.Horn
1030
- trigonometric (bool, optional): False: azimuth (0°=N, 90°=E, clockwise); True: 0°=E, counter-clockwise. default: False
1031
- zero_for_flat (bool, optional): Set flats (slope==0) to 0 instead of NoData. default: True
1032
- compute_edges (bool, optional): Whether to compute edges. default: True
1033
- nodata (int, optional): NoData value for the output raster. default = -9999
1034
- user_id (int, optional): specific user. priviledges required!
1035
-
1036
- Returns:
1037
- Task: task instance of the process
1038
-
1039
- Example:
1040
- >>> from geobox.aio import AsyncGeoboxClient
1041
- >>> async with AsyncGeoboxClient() as client:
1042
- >>> raster = await client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
1043
- >>> await raster.aspect(output_raster_name='test')
1044
- """
1045
- from .analysis import Analysis
1046
- return await Analysis.aspect(self.api,
1047
- self,
1048
- output_raster_name=output_raster_name,
1049
- algorithm=algorithm,
1050
- trigonometric=trigonometric,
1051
- zero_for_flat=zero_for_flat,
1052
- compute_edge=compute_edges,
1053
- nodata_out=nodata_out,
1054
- user_id=user_id)
1055
-
1056
-
1057
- async def reclassify(self,
1058
- output_raster_name: str,
1059
- rules: str,
1060
- default_value: Optional[int] = None,
1061
- nodata_in: int = -9999,
1062
- nodata_out: int = -9999,
1063
- out_dtype: AnalysisDataType = AnalysisDataType.int16,
1064
- inclusive: RangeBound = RangeBound.left,
1065
- user_id: Optional[int] = None) -> 'Task':
1066
- """
1067
- [async] Reclassify a raster using value mapping or class breaks.
1068
-
1069
- This endpoint reclassifies raster values according to specified rules.
1070
- Only users with Publisher role or higher can perform this operation.
1071
-
1072
- Args:
1073
- output_raster_name (str): Name for the output reclassified raster dataset.
1074
- rules (str): JSON string containing reclassification rules.
1075
- For mode='exact', it should be a dict {old_value: new_value}.
1076
- For mode='range', it should be a list of (low, high, new_value).
1077
- Example for mode='exact': '{"1": 10, "2": 20, "3": 30}'.
1078
- Example for mode='range': '[[0, 10, 1], [10, 20, 2], [20, 30, 3]]'.
1079
- the method would detect the mode type based on the rules input.
1080
- default_value (str, optional): Value to assign when a pixel matches no rule.
1081
- nodata_in (int, optional): NoData of input. If None, tries to get from the input raster.
1082
- nodata_out (int, optional): NoData value to set on output band.
1083
- out_dtype (AnalysisDataType, optional): Output data type. default: AnalysisDataType.int16
1084
- inclusive (RangeBound, optional): Range bound semantics for mode='range': 'left', 'right', 'both', 'neither'. default: RangeBound.left
1085
- user_id (int, optional): specific user. priviledges required!
1086
-
1087
- Returns:
1088
- Task: task instance of the process
1089
-
1090
- Example:
1091
- >>> from geobox.aio import AsyncGeoboxClient
1092
- >>> async with AsyncGeoboxClient() as client:
1093
- >>> raster = await client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
1094
- >>> await raster.reclassify(output_raster_name='test', rules='{"1": 10, "2": 20, "3": 30}')
1095
- """
1096
- from .analysis import Analysis
1097
- return await Analysis.reclassify(self.api,
1098
- self,
1099
- output_raster_name=output_raster_name,
1100
- rules=rules,
1101
- default_value=default_value,
1102
- nodata_in=nodata_in,
1103
- nodata_out=nodata_out,
1104
- out_dtype=out_dtype,
1105
- inclusive=inclusive,
1106
- user_id=user_id)
1107
-
1108
-
1109
- async def resample(self,
1110
- output_raster_name: str,
1111
- out_res: Optional[str] = None,
1112
- scale_factor: Optional[str] = None,
1113
- match_raster_uuid: Optional[str] = None,
1114
- resample_method: AnalysisResampleMethod = AnalysisResampleMethod.near,
1115
- dst_nodata: int = -9999,
1116
- user_id: Optional[int] = None) -> 'Task':
1117
- """
1118
- [async] Resample a raster to a different resolution.
1119
-
1120
- it resamples a raster using GDAL Warp.
1121
- Exactly one of out_res, scale_factor, or match_raster_uuid must be provided.
1122
- Only users with Publisher role or higher can perform this operation.
1123
-
1124
- Args:
1125
- output_raster_name (str): Name for the output reclassified raster dataset.
1126
- out_res (str, optional): Output resolution as 'x_res,y_res' (e.g., '10,10').
1127
- scale_factor (int, optional): Scale factor (e.g., 2.0 for 2x finer resolution).
1128
- match_raster_uuid (str, optional): UUID of reference raster to match resolution/extent.
1129
- resample_method (AnalysisResampleMethod, optional): Resampling method: 'near', 'bilinear', 'cubic', 'lanczos', etc.
1130
- dst_nodata (int, optional): Output NoData value.
1131
- user_id (int, optional): specific user. priviledges required!
866
+ from ..raster import Raster
1132
867
 
1133
- Returns:
1134
- Task: task instance of the process
1135
-
1136
- Example:
1137
- >>> from geobox.aio import AsyncGeoboxClient
1138
- >>> async with AsyncGeoboxClient() as client:
1139
- >>> raster = await client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
1140
- >>> await raster.resample(output_raster_name='test')
1141
- """
1142
- from .analysis import Analysis
1143
- return await Analysis.resample(self.api,
1144
- self,
1145
- output_raster_name=output_raster_name,
1146
- out_res=out_res,
1147
- scale_factor=scale_factor,
1148
- match_raster_uuid=match_raster_uuid,
1149
- resample_method=resample_method,
1150
- dst_nodata=dst_nodata,
1151
- user_id=user_id)
1152
-
1153
-
1154
- async def fill_nodata(self,
1155
- output_raster_name: str,
1156
- band: Union[int, str] = 1,
1157
- nodata: Optional[int] = None,
1158
- max_search_dist: Optional[int] = None,
1159
- smoothing_iterations: Optional[int] = None,
1160
- mask_raster_uuid: Optional[str] = None,
1161
- user_id: Optional[int] = None) -> 'Task':
1162
- """
1163
- [async] Fill NoData regions in a raster using GDAL's FillNodata algorithm.
1164
-
1165
- it fills gaps (NoData regions) in a raster by interpolating values from surrounding valid pixels.
1166
- This is commonly used for data cleaning and gap filling in remote sensing and elevation data.
1167
- Only users with Publisher role or higher can perform this operation.
1168
-
1169
- Args:
1170
- output_raster_name (str): Name for the output filled raster dataset.
1171
- band (int | str): 1-based band index to process or 'all' to process all bands. default: 1
1172
- nodata (int, optional): NoData value to use. If None, uses the band's existing NoData.
1173
- max_search_dist (int, optoinal): Maximum distance in pixels to search for valid data.
1174
- smoothing_iterations (int, optional): Number of smoothing iterations to apply.
1175
- mask_raster_uuid (str, optional): Optional UUID of a mask raster (0=masked, >0=valid).
1176
- user_id (int, optional): specific user. priviledges required!
1177
-
1178
- Returns:
1179
- Task: task instance of the process
1180
-
1181
- Example:
1182
- >>> from geobox.aio import AsyncGeoboxClient
1183
- >>> async with AsyncGeoboxClient() as client:
1184
- >>> raster = await client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
1185
- >>> task = await raster.fill_nodata(output_raster_name='test')
1186
- """
1187
- from .analysis import Analysis
1188
- return await Analysis.fill_nodata(self.api,
1189
- self,
1190
- output_raster_name=output_raster_name,
1191
- band=band,
1192
- nodata=nodata,
1193
- max_search_dist=max_search_dist,
1194
- smoothing_iterations=smoothing_iterations,
1195
- mask_raster_uuid=mask_raster_uuid,
1196
- user_id=user_id)
1197
-
1198
-
1199
- async def proximity(self,
1200
- output_raster_name: str,
1201
- dist_units: DistanceUnit = DistanceUnit.GEO,
1202
- burn_value: int = 1,
1203
- nodata: int = -9999,
1204
- user_id: Optional[int] = None) -> 'Task':
1205
- """
1206
- [async] Create a proximity (distance) raster from a raster layer.
1207
-
1208
- it creates a raster showing the distance from each pixel to the nearest pixel in the input raster layer.
1209
- Only users with Publisher role or higher can perform this operation.
1210
-
1211
- Args:
1212
- output_raster_name (str): Name for the output proximity raster dataset.
1213
- dist_units (DistanceUnit, optional): Distance units: 'GEO' for georeferenced units, 'PIXEL' for pixels. default: DistanceUnit.GEO
1214
- burn_value (int, optional): Value treated as targets (distance 0). default: 1
1215
- nodata (int, optional): NoData value to use in the output raster. default: -9999
1216
- user_id (int, optional): specific user. priviledges required!
1217
-
1218
- Returns:
1219
- Task: task instance of the process
1220
-
1221
- Example:
1222
- >>> from geobox.aio import AsyncGeoboxClient
1223
- >>> async with AsyncGeoboxClient() as client:
1224
- >>> raster = await client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
1225
- >>> task = await raster.proximity(output_raster_name='test')
1226
- """
1227
- from .analysis import Analysis
1228
- return await Analysis.proximity(self.api,
1229
- self,
1230
- output_raster_name=output_raster_name,
1231
- dist_units=dist_units,
1232
- burn_value=burn_value,
1233
- nodata=nodata,
1234
- user_id=user_id)
868
+ return Raster(api=sync_client, uuid=self.uuid, data=self.data)
1235
869
 
1236
870
 
1237
871
  async def profile(self,