geobox 2.0.1__py3-none-any.whl → 2.2.0__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 +489 -473
  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 +23 -33
  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 +907 -869
  20. geobox/aio/raster_analysis.py +740 -0
  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 +315 -306
  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 +18 -2
  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 +432 -348
  41. geobox/feature.py +5 -5
  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 +907 -863
  52. geobox/raster_analysis.py +737 -0
  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 -5
  62. geobox/version.py +272 -272
  63. geobox/view.py +981 -981
  64. geobox/workflow.py +338 -339
  65. {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/METADATA +15 -1
  66. geobox-2.2.0.dist-info/RECORD +72 -0
  67. geobox-2.0.1.dist-info/RECORD +0 -68
  68. {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/WHEEL +0 -0
  69. {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/licenses/LICENSE +0 -0
  70. {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/top_level.txt +0 -0
geobox/tile3d.py CHANGED
@@ -1,339 +1,338 @@
1
- from typing import List, Dict, Optional, TYPE_CHECKING, Union
2
- from urllib.parse import urljoin
3
-
4
- from .base import Base
5
-
6
- if TYPE_CHECKING:
7
- from . import GeoboxClient
8
- from .user import User
9
- from .aio import AsyncGeoboxClient
10
- from .aio.tile3d import Tile3d as AsyncTile3d
11
-
12
-
13
- class Tile3d(Base):
14
-
15
- BASE_ENDPOINT = '3dtiles/'
16
-
17
- def __init__(self,
18
- api: 'GeoboxClient',
19
- uuid: str,
20
- data: Optional[Dict] = {}):
21
- """
22
- Initialize a 3D Tile instance.
23
-
24
- Args:
25
- api (GeoboxClient): The GeoboxClient instance for making requests.
26
- name (str): The name of the 3D Tile.
27
- uuid (str): The unique identifier for the 3D Tile.
28
- data (Dict): The data of the 3D Tile.
29
- """
30
- super().__init__(api, uuid=uuid, data=data)
31
-
32
-
33
- @classmethod
34
- def get_3dtiles(cls, api: 'GeoboxClient', **kwargs) -> Union[List['Tile3d'], int]:
35
- """
36
- Get list of 3D Tiles with optional filtering and pagination.
37
-
38
- Args:
39
- api (GeoboxClient): The GeoboxClient instance for making requests.
40
-
41
- Keyword Args:
42
- q (str): query filter based on OGC CQL standard. e.g. "field1 LIKE '%GIS%' AND created_at > '2021-01-01'"
43
- search (str): search term for keyword-based searching among search_fields or all textual fields if search_fields does not have value. NOTE: if q param is defined this param will be ignored.
44
- search_fields (str): comma separated list of fields for searching.
45
- order_by (str): comma separated list of fields for sorting results [field1 A|D, field2 A|D, …]. e.g. name A, type D. NOTE: "A" denotes ascending order and "D" denotes descending order.
46
- return_count (bool): Whether to return total count. default is False.
47
- skip (int): Number of items to skip. default is 0.
48
- limit (int): Number of items to return. default is 10.
49
- user_id (int): Specific user. privileges required.
50
- shared (bool): Whether to return shared maps. default is False.
51
-
52
- Returns:
53
- List[Tile3d] | int: A list of 3D Tile instances or the total number of 3D Tiles.
54
-
55
- Example:
56
- >>> from geobox import GeoboxClient
57
- >>> from geobox.tile3d import Tile3d
58
- >>> client = GeoboxClient()
59
- >>> tiles = Tile3d.get_3dtiles(client, q="name LIKE '%My tile%'")
60
- or
61
- >>> tiles = client.get_3dtiles(q="name LIKE '%My tile%'")
62
- """
63
- params = {
64
- 'f': 'json',
65
- 'q': kwargs.get('q'),
66
- 'search': kwargs.get('search'),
67
- 'search_fields': kwargs.get('search_fields'),
68
- 'order_by': kwargs.get('order_by'),
69
- 'return_count': kwargs.get('return_count', False),
70
- 'skip': kwargs.get('skip', 0),
71
- 'limit': kwargs.get('limit', 10),
72
- 'user_id': kwargs.get('user_id'),
73
- 'shared': kwargs.get('shared', False)
74
- }
75
- return super()._get_list(api, cls.BASE_ENDPOINT, params, factory_func=lambda api, item: Tile3d(api, item['uuid'], item))
76
-
77
-
78
- @classmethod
79
- def get_3dtile(cls, api: 'GeoboxClient', uuid: str, user_id: int = None) -> 'Tile3d':
80
- """
81
- Get a 3D Tile by its UUID.
82
-
83
- Args:
84
- api (GeoboxClient): The GeoboxClient instance for making requests.
85
- uuid (str): The UUID of the map to 3D Tile.
86
- user_id (int): Specific user. privileges required.
87
-
88
- Returns:
89
- Tile3d: The 3D Tile object.
90
-
91
- Raises:
92
- NotFoundError: If the 3D Tile with the specified UUID is not found.
93
-
94
- Example:
95
- >>> from geobox import GeoboxClient
96
- >>> from geobox.tile3d import Tile3d
97
- >>> client = GeoboxClient()
98
- >>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
99
- or
100
- >>> tile = client.get_3dtile(uuid="12345678-1234-5678-1234-567812345678")
101
- """
102
- params = {
103
- 'f': 'json',
104
- 'user_id': user_id,
105
- }
106
- return super()._get_detail(api, cls.BASE_ENDPOINT, uuid, params, factory_func=lambda api, item: Tile3d(api, item['uuid'], item))
107
-
108
-
109
- @classmethod
110
- def get_3dtile_by_name(cls, api: 'GeoboxClient', name: str, user_id: int = None) -> Union['Tile3d', None]:
111
- """
112
- Get a 3dtile by name
113
-
114
- Args:
115
- api (GeoboxClient): The GeoboxClient instance for making requests.
116
- name (str): the name of the 3dtile to get
117
- user_id (int, optional): specific user. privileges required.
118
-
119
- Returns:
120
- Tile3d | None: returns the 3dtile if a 3dtile matches the given name, else None
121
-
122
- Example:
123
- >>> from geobox import GeoboxClient
124
- >>> from geobox.tile3d import Tile3d
125
- >>> client = GeoboxClient()
126
- >>> tile3d = Tile3d.get_3dtile_by_name(client, name='test')
127
- or
128
- >>> tile3d = client.get_3dtile_by_name(name='test')
129
- """
130
- tile3ds = cls.get_3dtiles(api, q=f"name = '{name}'", user_id=user_id)
131
- if tile3ds and tile3ds[0].name == name:
132
- return tile3ds[0]
133
- else:
134
- return None
135
-
136
-
137
- def update(self, **kwargs) -> Dict:
138
- """
139
- Update the 3D Tile.
140
-
141
- Keyword Args:
142
- name (str): The name of the 3D Tile.
143
- display_name (str): The display name of the 3D Tile.
144
- description (str): The description of the 3D Tile.
145
- settings (Dict): The settings of the 3D Tile.
146
- thumbnail (str): The thumbnail of the 3D Tile.
147
-
148
- Returns:
149
- Dict: The updated 3D Tile data.
150
-
151
- Raises:
152
- ApiRequestError: If the API request fails.
153
- ValidationError: If the 3D Tile data is invalid.
154
-
155
- Example:
156
- >>> from geobox import GeoboxClient
157
- >>> from geobox.tile3d import Tile3d
158
- >>> client = GeoboxClient()
159
- >>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
160
- >>> tile.update_3dtile(display_name="New Display Name")
161
- """
162
- data = {
163
- "name": kwargs.get('name'),
164
- "display_name": kwargs.get('display_name'),
165
- "description": kwargs.get('description'),
166
- "settings": kwargs.get('settings'),
167
- "thumbnail": kwargs.get('thumbnail'),
168
- }
169
- return super()._update(self.endpoint, data)
170
-
171
-
172
- def delete(self) -> None:
173
- """
174
- Delete the 3D Tile.
175
-
176
- Returns:
177
- None
178
-
179
- Example:
180
- >>> from geobox import GeoboxClient
181
- >>> from geobox.tile3d import Tile3d
182
- >>> client = GeoboxClient()
183
- >>> tile = Map.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
184
- >>> tile.delete()
185
- """
186
- super().delete(self.endpoint)
187
-
188
-
189
- @property
190
- def thumbnail(self) -> str:
191
- """
192
- Get the thumbnail URL of the 3D Tile.
193
-
194
- Returns:
195
- str: The thumbnail url of the 3D Tile.
196
-
197
- Example:
198
- >>> from geobox import GeoboxClient
199
- >>> from geobox.tile3d import Tile3d
200
- >>> client = GeoboxClient()
201
- >>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
202
- >>> tile.thumbnail
203
- 'https://example.com/thumbnail.png'
204
- """
205
- return super().thumbnail()
206
-
207
-
208
- def get_item(self, path: str) -> Dict:
209
- """
210
- Get an Item from 3D Tiles
211
-
212
- Args:
213
- path (str): the path of the item.
214
-
215
- Returns:
216
- Dict: the data of the item.
217
-
218
- Example:
219
- >>> from geobox imoprt GeoboxClient
220
- >>> from geobox.tile3d import Tile3d
221
- >>> client = GeoboxClient()
222
- >>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
223
- or
224
- >>> tile = client.get_3dtile(uuid="12345678-1234-5678-1234-567812345678")
225
- >>> item = tile.get_item()
226
- """
227
- endpoint = f"{self.endpoint}{path}"
228
- return self.api.get(endpoint)
229
-
230
-
231
- def share(self, users: List['User']) -> None:
232
- """
233
- Shares the 3D Tile with specified users.
234
-
235
- Args:
236
- users (List[User]): The list of user objects to share the 3D Tile with.
237
-
238
- Returns:
239
- None
240
-
241
- Example:
242
- >>> from geobox import GeoboxClient
243
- >>> from geobox.tile3d import Tile3d
244
- >>> client = GeoboxClient()
245
- >>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
246
- >>> users = client.search_users(search='John')
247
- >>> tile.share(users=users)
248
- """
249
- super()._share(self.endpoint, users)
250
-
251
-
252
- def unshare(self, users: List['User']) -> None:
253
- """
254
- Unshares the 3D Tile with specified users.
255
-
256
- Args:
257
- users (List[User]): The list of user objects to unshare the 3D Tile with.
258
-
259
- Returns:
260
- None
261
-
262
- Example:
263
- >>> from geobox import GeoboxClient
264
- >>> from geobox.tile3d import Tile3d
265
- >>> client = GeoboxClient()
266
- >>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
267
- >>> users = client.search_users(search='John')
268
- >>> tile.unshare(users=users)
269
- """
270
- super()._unshare(self.endpoint, users)
271
-
272
-
273
- def get_shared_users(self, search: str = None, skip: int = 0, limit: int = 10) -> List['User']:
274
- """
275
- Retrieves the list of users the 3D Tile is shared with.
276
-
277
- Args:
278
- search (str, optional): The search query.
279
- skip (int, optional): The number of users to skip.
280
- limit (int, optional): The maximum number of users to retrieve.
281
-
282
- Returns:
283
- List[User]: The list of shared users.
284
-
285
- Example:
286
- >>> from geobox import GeoboxClient
287
- >>> from geobox.tile3d import Tile3d
288
- >>> client = GeoboxClient()
289
- >>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
290
- >>> tile.get_shared_users(search='John', skip=0, limit=10)
291
- """
292
- params = {
293
- 'search': search,
294
- 'skip': skip,
295
- 'limit': limit
296
- }
297
- return super()._get_shared_users(self.endpoint, params)
298
-
299
-
300
- def get_tileset_json(self) -> Dict:
301
- """
302
- Get Tileset JSON of a 3D Tiles.
303
-
304
- Returns:
305
- Dict: The tileset JSON configuration.
306
-
307
- Example:
308
- >>> from geobox import GeoboxClient
309
- >>> from geobox.tile3d import Tile3d
310
- >>> client = GeoboxClient()
311
- >>> tile = Tile3d.get_3dtile(api=client, uuid="12345678-1234-5678-1234-567812345678")
312
- >>> tile_json = tile.get_tileset_json()
313
- """
314
- endpoint = urljoin(self.endpoint, 'tileset.json')
315
- return self.api.get(endpoint)
316
-
317
-
318
- def to_async(self, async_client: 'AsyncGeoboxClient') -> 'AsyncTile3d':
319
- """
320
- Switch to async version of the 3d tile instance to have access to the async methods
321
-
322
- Args:
323
- async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
324
-
325
- Returns:
326
- geobox.aio.tile3d.Tile3d: the async instance of the 3d tile.
327
-
328
- Example:
329
- >>> from geobox import Geoboxclient
330
- >>> from geobox.aio import AsyncGeoboxClient
331
- >>> from geobox.tile3d import Tile3d
332
- >>> client = GeoboxClient()
333
- >>> tile = Tile3d.get_3dtile(api=client, uuid="12345678-1234-5678-1234-567812345678")
334
- >>> async with AsyncGeoboxClient() as async_client:
335
- >>> async_tile = tile.to_async(async_client)
336
- """
337
- from .aio.tile3d import Tile3d as AsyncTile3d
338
-
1
+ from typing import List, Dict, Optional, TYPE_CHECKING, Union
2
+ from urllib.parse import urljoin
3
+
4
+ from .base import Base
5
+
6
+ if TYPE_CHECKING:
7
+ from . import GeoboxClient
8
+ from .user import User
9
+ from .aio import AsyncGeoboxClient
10
+ from .aio.tile3d import AsyncTile3d
11
+
12
+
13
+ class Tile3d(Base):
14
+
15
+ BASE_ENDPOINT = '3dtiles/'
16
+
17
+ def __init__(self,
18
+ api: 'GeoboxClient',
19
+ uuid: str,
20
+ data: Optional[Dict] = {}):
21
+ """
22
+ Initialize a 3D Tile instance.
23
+
24
+ Args:
25
+ api (GeoboxClient): The GeoboxClient instance for making requests.
26
+ name (str): The name of the 3D Tile.
27
+ uuid (str): The unique identifier for the 3D Tile.
28
+ data (Dict): The data of the 3D Tile.
29
+ """
30
+ super().__init__(api, uuid=uuid, data=data)
31
+
32
+
33
+ @classmethod
34
+ def get_3dtiles(cls, api: 'GeoboxClient', **kwargs) -> Union[List['Tile3d'], int]:
35
+ """
36
+ Get list of 3D Tiles with optional filtering and pagination.
37
+
38
+ Args:
39
+ api (GeoboxClient): The GeoboxClient instance for making requests.
40
+
41
+ Keyword Args:
42
+ q (str): query filter based on OGC CQL standard. e.g. "field1 LIKE '%GIS%' AND created_at > '2021-01-01'"
43
+ search (str): search term for keyword-based searching among search_fields or all textual fields if search_fields does not have value. NOTE: if q param is defined this param will be ignored.
44
+ search_fields (str): comma separated list of fields for searching.
45
+ order_by (str): comma separated list of fields for sorting results [field1 A|D, field2 A|D, …]. e.g. name A, type D. NOTE: "A" denotes ascending order and "D" denotes descending order.
46
+ return_count (bool): Whether to return total count. default is False.
47
+ skip (int): Number of items to skip. default is 0.
48
+ limit (int): Number of items to return. default is 10.
49
+ user_id (int): Specific user. privileges required.
50
+ shared (bool): Whether to return shared maps. default is False.
51
+
52
+ Returns:
53
+ List[Tile3d] | int: A list of 3D Tile instances or the total number of 3D Tiles.
54
+
55
+ Example:
56
+ >>> from geobox import GeoboxClient
57
+ >>> from geobox.tile3d import Tile3d
58
+ >>> client = GeoboxClient()
59
+ >>> tiles = Tile3d.get_3dtiles(client, q="name LIKE '%My tile%'")
60
+ or
61
+ >>> tiles = client.get_3dtiles(q="name LIKE '%My tile%'")
62
+ """
63
+ params = {
64
+ 'f': 'json',
65
+ 'q': kwargs.get('q'),
66
+ 'search': kwargs.get('search'),
67
+ 'search_fields': kwargs.get('search_fields'),
68
+ 'order_by': kwargs.get('order_by'),
69
+ 'return_count': kwargs.get('return_count', False),
70
+ 'skip': kwargs.get('skip', 0),
71
+ 'limit': kwargs.get('limit', 10),
72
+ 'user_id': kwargs.get('user_id'),
73
+ 'shared': kwargs.get('shared', False)
74
+ }
75
+ return super()._get_list(api, cls.BASE_ENDPOINT, params, factory_func=lambda api, item: Tile3d(api, item['uuid'], item))
76
+
77
+
78
+ @classmethod
79
+ def get_3dtile(cls, api: 'GeoboxClient', uuid: str, user_id: int = None) -> 'Tile3d':
80
+ """
81
+ Get a 3D Tile by its UUID.
82
+
83
+ Args:
84
+ api (GeoboxClient): The GeoboxClient instance for making requests.
85
+ uuid (str): The UUID of the map to 3D Tile.
86
+ user_id (int): Specific user. privileges required.
87
+
88
+ Returns:
89
+ Tile3d: The 3D Tile object.
90
+
91
+ Raises:
92
+ NotFoundError: If the 3D Tile with the specified UUID is not found.
93
+
94
+ Example:
95
+ >>> from geobox import GeoboxClient
96
+ >>> from geobox.tile3d import Tile3d
97
+ >>> client = GeoboxClient()
98
+ >>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
99
+ or
100
+ >>> tile = client.get_3dtile(uuid="12345678-1234-5678-1234-567812345678")
101
+ """
102
+ params = {
103
+ 'f': 'json',
104
+ 'user_id': user_id,
105
+ }
106
+ return super()._get_detail(api, cls.BASE_ENDPOINT, uuid, params, factory_func=lambda api, item: Tile3d(api, item['uuid'], item))
107
+
108
+
109
+ @classmethod
110
+ def get_3dtile_by_name(cls, api: 'GeoboxClient', name: str, user_id: int = None) -> Union['Tile3d', None]:
111
+ """
112
+ Get a 3dtile by name
113
+
114
+ Args:
115
+ api (GeoboxClient): The GeoboxClient instance for making requests.
116
+ name (str): the name of the 3dtile to get
117
+ user_id (int, optional): specific user. privileges required.
118
+
119
+ Returns:
120
+ Tile3d | None: returns the 3dtile if a 3dtile matches the given name, else None
121
+
122
+ Example:
123
+ >>> from geobox import GeoboxClient
124
+ >>> from geobox.tile3d import Tile3d
125
+ >>> client = GeoboxClient()
126
+ >>> tile3d = Tile3d.get_3dtile_by_name(client, name='test')
127
+ or
128
+ >>> tile3d = client.get_3dtile_by_name(name='test')
129
+ """
130
+ tile3ds = cls.get_3dtiles(api, q=f"name = '{name}'", user_id=user_id)
131
+ if tile3ds and tile3ds[0].name == name:
132
+ return tile3ds[0]
133
+ else:
134
+ return None
135
+
136
+
137
+ def update(self, **kwargs) -> Dict:
138
+ """
139
+ Update the 3D Tile.
140
+
141
+ Keyword Args:
142
+ name (str): The name of the 3D Tile.
143
+ display_name (str): The display name of the 3D Tile.
144
+ description (str): The description of the 3D Tile.
145
+ settings (Dict): The settings of the 3D Tile.
146
+ thumbnail (str): The thumbnail of the 3D Tile.
147
+
148
+ Returns:
149
+ Dict: The updated 3D Tile data.
150
+
151
+ Raises:
152
+ ApiRequestError: If the API request fails.
153
+ ValidationError: If the 3D Tile data is invalid.
154
+
155
+ Example:
156
+ >>> from geobox import GeoboxClient
157
+ >>> from geobox.tile3d import Tile3d
158
+ >>> client = GeoboxClient()
159
+ >>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
160
+ >>> tile.update_3dtile(display_name="New Display Name")
161
+ """
162
+ data = {
163
+ "name": kwargs.get('name'),
164
+ "display_name": kwargs.get('display_name'),
165
+ "description": kwargs.get('description'),
166
+ "settings": kwargs.get('settings'),
167
+ "thumbnail": kwargs.get('thumbnail'),
168
+ }
169
+ return super()._update(self.endpoint, data)
170
+
171
+
172
+ def delete(self) -> None:
173
+ """
174
+ Delete the 3D Tile.
175
+
176
+ Returns:
177
+ None
178
+
179
+ Example:
180
+ >>> from geobox import GeoboxClient
181
+ >>> from geobox.tile3d import Tile3d
182
+ >>> client = GeoboxClient()
183
+ >>> tile = Map.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
184
+ >>> tile.delete()
185
+ """
186
+ super()._delete(self.endpoint)
187
+
188
+
189
+ @property
190
+ def thumbnail(self) -> str:
191
+ """
192
+ Get the thumbnail URL of the 3D Tile.
193
+
194
+ Returns:
195
+ str: The thumbnail url of the 3D Tile.
196
+
197
+ Example:
198
+ >>> from geobox import GeoboxClient
199
+ >>> from geobox.tile3d import Tile3d
200
+ >>> client = GeoboxClient()
201
+ >>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
202
+ >>> tile.thumbnail
203
+ """
204
+ return super()._thumbnail()
205
+
206
+
207
+ def get_item(self, path: str) -> Dict:
208
+ """
209
+ Get an Item from 3D Tiles
210
+
211
+ Args:
212
+ path (str): the path of the item.
213
+
214
+ Returns:
215
+ Dict: the data of the item.
216
+
217
+ Example:
218
+ >>> from geobox imoprt GeoboxClient
219
+ >>> from geobox.tile3d import Tile3d
220
+ >>> client = GeoboxClient()
221
+ >>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
222
+ or
223
+ >>> tile = client.get_3dtile(uuid="12345678-1234-5678-1234-567812345678")
224
+ >>> item = tile.get_item()
225
+ """
226
+ endpoint = f"{self.endpoint}{path}"
227
+ return self.api.get(endpoint)
228
+
229
+
230
+ def share(self, users: List['User']) -> None:
231
+ """
232
+ Shares the 3D Tile with specified users.
233
+
234
+ Args:
235
+ users (List[User]): The list of user objects to share the 3D Tile with.
236
+
237
+ Returns:
238
+ None
239
+
240
+ Example:
241
+ >>> from geobox import GeoboxClient
242
+ >>> from geobox.tile3d import Tile3d
243
+ >>> client = GeoboxClient()
244
+ >>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
245
+ >>> users = client.search_users(search='John')
246
+ >>> tile.share(users=users)
247
+ """
248
+ super()._share(self.endpoint, users)
249
+
250
+
251
+ def unshare(self, users: List['User']) -> None:
252
+ """
253
+ Unshares the 3D Tile with specified users.
254
+
255
+ Args:
256
+ users (List[User]): The list of user objects to unshare the 3D Tile with.
257
+
258
+ Returns:
259
+ None
260
+
261
+ Example:
262
+ >>> from geobox import GeoboxClient
263
+ >>> from geobox.tile3d import Tile3d
264
+ >>> client = GeoboxClient()
265
+ >>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
266
+ >>> users = client.search_users(search='John')
267
+ >>> tile.unshare(users=users)
268
+ """
269
+ super()._unshare(self.endpoint, users)
270
+
271
+
272
+ def get_shared_users(self, search: str = None, skip: int = 0, limit: int = 10) -> List['User']:
273
+ """
274
+ Retrieves the list of users the 3D Tile is shared with.
275
+
276
+ Args:
277
+ search (str, optional): The search query.
278
+ skip (int, optional): The number of users to skip.
279
+ limit (int, optional): The maximum number of users to retrieve.
280
+
281
+ Returns:
282
+ List[User]: The list of shared users.
283
+
284
+ Example:
285
+ >>> from geobox import GeoboxClient
286
+ >>> from geobox.tile3d import Tile3d
287
+ >>> client = GeoboxClient()
288
+ >>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
289
+ >>> tile.get_shared_users(search='John', skip=0, limit=10)
290
+ """
291
+ params = {
292
+ 'search': search,
293
+ 'skip': skip,
294
+ 'limit': limit
295
+ }
296
+ return super()._get_shared_users(self.endpoint, params)
297
+
298
+
299
+ def get_tileset_json(self) -> Dict:
300
+ """
301
+ Get Tileset JSON of a 3D Tiles.
302
+
303
+ Returns:
304
+ Dict: The tileset JSON configuration.
305
+
306
+ Example:
307
+ >>> from geobox import GeoboxClient
308
+ >>> from geobox.tile3d import Tile3d
309
+ >>> client = GeoboxClient()
310
+ >>> tile = Tile3d.get_3dtile(api=client, uuid="12345678-1234-5678-1234-567812345678")
311
+ >>> tile_json = tile.get_tileset_json()
312
+ """
313
+ endpoint = urljoin(self.endpoint, 'tileset.json')
314
+ return self.api.get(endpoint)
315
+
316
+
317
+ def to_async(self, async_client: 'AsyncGeoboxClient') -> 'AsyncTile3d':
318
+ """
319
+ Switch to async version of the 3d tile instance to have access to the async methods
320
+
321
+ Args:
322
+ async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
323
+
324
+ Returns:
325
+ AsyncTile3d: the async instance of the 3d tile.
326
+
327
+ Example:
328
+ >>> from geobox import Geoboxclient
329
+ >>> from geobox.aio import AsyncGeoboxClient
330
+ >>> from geobox.tile3d import Tile3d
331
+ >>> client = GeoboxClient()
332
+ >>> tile = Tile3d.get_3dtile(api=client, uuid="12345678-1234-5678-1234-567812345678")
333
+ >>> async with AsyncGeoboxClient() as async_client:
334
+ >>> async_tile = tile.to_async(async_client)
335
+ """
336
+ from .aio.tile3d import AsyncTile3d
337
+
339
338
  return AsyncTile3d(api=async_client, uuid=self.uuid, data=self.data)