pygeobox 1.0.3__py3-none-any.whl → 1.0.4__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.
- pygeobox/__init__.py +63 -63
- pygeobox/api.py +2517 -2517
- pygeobox/apikey.py +232 -232
- pygeobox/attachment.py +297 -297
- pygeobox/base.py +364 -364
- pygeobox/basemap.py +162 -162
- pygeobox/dashboard.py +316 -316
- pygeobox/enums.py +354 -354
- pygeobox/exception.py +47 -47
- pygeobox/field.py +309 -309
- pygeobox/map.py +858 -858
- pygeobox/model3d.py +334 -334
- pygeobox/mosaic.py +647 -647
- pygeobox/plan.py +260 -260
- pygeobox/query.py +668 -668
- pygeobox/raster.py +756 -756
- pygeobox/route.py +63 -63
- pygeobox/scene.py +317 -317
- pygeobox/settings.py +165 -165
- pygeobox/task.py +354 -354
- pygeobox/tile3d.py +294 -294
- pygeobox/tileset.py +585 -585
- pygeobox/user.py +423 -423
- pygeobox/utils.py +43 -43
- pygeobox/vectorlayer.py +1149 -1149
- pygeobox/version.py +248 -248
- pygeobox/view.py +859 -859
- pygeobox/workflow.py +315 -315
- {pygeobox-1.0.3.dist-info → pygeobox-1.0.4.dist-info}/METADATA +3 -5
- pygeobox-1.0.4.dist-info/RECORD +37 -0
- {pygeobox-1.0.3.dist-info → pygeobox-1.0.4.dist-info}/licenses/LICENSE +21 -21
- pygeobox-1.0.3.dist-info/RECORD +0 -37
- {pygeobox-1.0.3.dist-info → pygeobox-1.0.4.dist-info}/WHEEL +0 -0
- {pygeobox-1.0.3.dist-info → pygeobox-1.0.4.dist-info}/top_level.txt +0 -0
pygeobox/tile3d.py
CHANGED
@@ -1,295 +1,295 @@
|
|
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
|
-
|
9
|
-
|
10
|
-
class Tile3d(Base):
|
11
|
-
|
12
|
-
BASE_ENDPOINT = '3dtiles/'
|
13
|
-
|
14
|
-
def __init__(self,
|
15
|
-
api: 'GeoboxClient',
|
16
|
-
uuid: str,
|
17
|
-
data: Optional[Dict] = {}):
|
18
|
-
"""
|
19
|
-
Initialize a 3D Tile instance.
|
20
|
-
|
21
|
-
Args:
|
22
|
-
api (GeoboxClient): The GeoboxClient instance for making requests.
|
23
|
-
name (str): The name of the 3D Tile.
|
24
|
-
uuid (str): The unique identifier for the 3D Tile.
|
25
|
-
data (Dict): The data of the 3D Tile.
|
26
|
-
"""
|
27
|
-
super().__init__(api, uuid=uuid, data=data)
|
28
|
-
|
29
|
-
|
30
|
-
@classmethod
|
31
|
-
def get_3dtiles(cls, api: 'GeoboxClient', **kwargs) -> Union[List['Tile3d'], int]:
|
32
|
-
"""
|
33
|
-
Get list of 3D Tiles with optional filtering and pagination.
|
34
|
-
|
35
|
-
Args:
|
36
|
-
api (GeoboxClient): The GeoboxClient instance for making requests.
|
37
|
-
|
38
|
-
Keyword Args:
|
39
|
-
q (str): query filter based on OGC CQL standard. e.g. "field1 LIKE '%GIS%' AND created_at > '2021-01-01'"
|
40
|
-
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.
|
41
|
-
search_fields (str): comma separated list of fields for searching.
|
42
|
-
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.
|
43
|
-
return_count (bool): Whether to return total count. default is False.
|
44
|
-
skip (int): Number of items to skip. default is 0.
|
45
|
-
limit (int): Number of items to return. default is 10.
|
46
|
-
user_id (int): Specific user. privileges required.
|
47
|
-
shared (bool): Whether to return shared maps. default is False.
|
48
|
-
|
49
|
-
Returns:
|
50
|
-
List[Tile3d] | int: A list of 3D Tile instances or the total number of 3D Tiles.
|
51
|
-
|
52
|
-
Example:
|
53
|
-
>>> from geobox import GeoboxClient
|
54
|
-
>>> from geobox.tile3d import Tile3d
|
55
|
-
>>> client = GeoboxClient()
|
56
|
-
>>> tiles = Tile3d.get_3dtiles(client, q="name LIKE '%My tile%'")
|
57
|
-
or
|
58
|
-
>>> tiles = client.get_3dtiles(q="name LIKE '%My tile%'")
|
59
|
-
"""
|
60
|
-
params = {
|
61
|
-
'f': 'json',
|
62
|
-
'q': kwargs.get('q'),
|
63
|
-
'search': kwargs.get('search'),
|
64
|
-
'search_fields': kwargs.get('search_fields'),
|
65
|
-
'order_by': kwargs.get('order_by'),
|
66
|
-
'return_count': kwargs.get('return_count', False),
|
67
|
-
'skip': kwargs.get('skip', 0),
|
68
|
-
'limit': kwargs.get('limit', 10),
|
69
|
-
'user_id': kwargs.get('user_id'),
|
70
|
-
'shared': kwargs.get('shared', False)
|
71
|
-
}
|
72
|
-
return super()._get_list(api, cls.BASE_ENDPOINT, params, factory_func=lambda api, item: Tile3d(api, item['uuid'], item))
|
73
|
-
|
74
|
-
|
75
|
-
@classmethod
|
76
|
-
def get_3dtile(cls, api: 'GeoboxClient', uuid: str, user_id: int = None) -> 'Tile3d':
|
77
|
-
"""
|
78
|
-
Get a 3D Tile by its UUID.
|
79
|
-
|
80
|
-
Args:
|
81
|
-
api (GeoboxClient): The GeoboxClient instance for making requests.
|
82
|
-
uuid (str): The UUID of the map to 3D Tile.
|
83
|
-
user_id (int): Specific user. privileges required.
|
84
|
-
|
85
|
-
Returns:
|
86
|
-
Tile3d: The 3D Tile object.
|
87
|
-
|
88
|
-
Raises:
|
89
|
-
NotFoundError: If the 3D Tile with the specified UUID is not found.
|
90
|
-
|
91
|
-
Example:
|
92
|
-
>>> from geobox import GeoboxClient
|
93
|
-
>>> from geobox.tile3d import Tile3d
|
94
|
-
>>> client = GeoboxClient()
|
95
|
-
>>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
96
|
-
or
|
97
|
-
>>> tile = client.get_3dtile(uuid="12345678-1234-5678-1234-567812345678")
|
98
|
-
"""
|
99
|
-
params = {
|
100
|
-
'f': 'json',
|
101
|
-
'user_id': user_id,
|
102
|
-
}
|
103
|
-
return super()._get_detail(api, cls.BASE_ENDPOINT, uuid, params, factory_func=lambda api, item: Tile3d(api, item['uuid'], item))
|
104
|
-
|
105
|
-
|
106
|
-
@classmethod
|
107
|
-
def get_3dtile_by_name(cls, api: 'GeoboxClient', name: str, user_id: int = None) -> Union['Tile3d', None]:
|
108
|
-
"""
|
109
|
-
Get a 3dtile by name
|
110
|
-
|
111
|
-
Args:
|
112
|
-
api (GeoboxClient): The GeoboxClient instance for making requests.
|
113
|
-
name (str): the name of the 3dtile to get
|
114
|
-
user_id (int, optional): specific user. privileges required.
|
115
|
-
|
116
|
-
Returns:
|
117
|
-
Tile3d | None: returns the 3dtile if a 3dtile matches the given name, else None
|
118
|
-
|
119
|
-
Example:
|
120
|
-
>>> from geobox import GeoboxClient
|
121
|
-
>>> from geobox.tile3d import Tile3d
|
122
|
-
>>> client = GeoboxClient()
|
123
|
-
>>> tile3d = Tile3d.get_3dtile_by_name(client, name='test')
|
124
|
-
or
|
125
|
-
>>> tile3d = client.get_3dtile_by_name(name='test')
|
126
|
-
"""
|
127
|
-
tile3ds = cls.get_3dtiles(api, q=f"name = '{name}'", user_id=user_id)
|
128
|
-
if tile3ds and tile3ds[0].name == name:
|
129
|
-
return tile3ds[0]
|
130
|
-
else:
|
131
|
-
return None
|
132
|
-
|
133
|
-
|
134
|
-
def update(self, **kwargs) -> Dict:
|
135
|
-
"""
|
136
|
-
Update the 3D Tile.
|
137
|
-
|
138
|
-
Keyword Args:
|
139
|
-
name (str): The name of the 3D Tile.
|
140
|
-
display_name (str): The display name of the 3D Tile.
|
141
|
-
description (str): The description of the 3D Tile.
|
142
|
-
settings (Dict): The settings of the 3D Tile.
|
143
|
-
thumbnail (str): The thumbnail of the 3D Tile.
|
144
|
-
|
145
|
-
Returns:
|
146
|
-
Dict: The updated 3D Tile data.
|
147
|
-
|
148
|
-
Raises:
|
149
|
-
ApiRequestError: If the API request fails.
|
150
|
-
ValidationError: If the 3D Tile data is invalid.
|
151
|
-
|
152
|
-
Example:
|
153
|
-
>>> from geobox import GeoboxClient
|
154
|
-
>>> from geobox.tile3d import Tile3d
|
155
|
-
>>> client = GeoboxClient()
|
156
|
-
>>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
157
|
-
>>> tile.update_3dtile(display_name="New Display Name")
|
158
|
-
"""
|
159
|
-
data = {
|
160
|
-
"name": kwargs.get('name'),
|
161
|
-
"display_name": kwargs.get('display_name'),
|
162
|
-
"description": kwargs.get('description'),
|
163
|
-
"settings": kwargs.get('settings'),
|
164
|
-
"thumbnail": kwargs.get('thumbnail'),
|
165
|
-
}
|
166
|
-
return super()._update(self.endpoint, data)
|
167
|
-
|
168
|
-
|
169
|
-
def delete(self) -> None:
|
170
|
-
"""
|
171
|
-
Delete the 3D Tile.
|
172
|
-
|
173
|
-
Returns:
|
174
|
-
None
|
175
|
-
|
176
|
-
Example:
|
177
|
-
>>> from geobox import GeoboxClient
|
178
|
-
>>> from geobox.tile3d import Tile3d
|
179
|
-
>>> client = GeoboxClient()
|
180
|
-
>>> tile = Map.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
181
|
-
>>> tile.delete()
|
182
|
-
"""
|
183
|
-
super().delete(self.endpoint)
|
184
|
-
|
185
|
-
|
186
|
-
@property
|
187
|
-
def thumbnail(self) -> str:
|
188
|
-
"""
|
189
|
-
Get the thumbnail URL of the 3D Tile.
|
190
|
-
|
191
|
-
Returns:
|
192
|
-
str: The thumbnail url of the 3D Tile.
|
193
|
-
|
194
|
-
Example:
|
195
|
-
>>> from geobox import GeoboxClient
|
196
|
-
>>> from geobox.tile3d import Tile3d
|
197
|
-
>>> client = GeoboxClient()
|
198
|
-
>>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
199
|
-
>>> tile.thumbnail
|
200
|
-
'https://example.com/thumbnail.png'
|
201
|
-
"""
|
202
|
-
endpoint = urljoin(self.api.base_url, f'{self.endpoint}thumbnail.png')
|
203
|
-
return endpoint
|
204
|
-
|
205
|
-
|
206
|
-
def get_item(self, path: str) -> Dict:
|
207
|
-
"""
|
208
|
-
Get an Item from 3D Tiles
|
209
|
-
|
210
|
-
Args:
|
211
|
-
path (str): the path of the item.
|
212
|
-
|
213
|
-
Returns:
|
214
|
-
Dict: the data of the item.
|
215
|
-
|
216
|
-
Example:
|
217
|
-
>>> from geobox imoprt GeoboxClient
|
218
|
-
>>> from geobox.tile3d import Tile3d
|
219
|
-
>>> client = GeoboxClient()
|
220
|
-
>>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
221
|
-
or
|
222
|
-
>>> tile = client.get_3dtile(uuid="12345678-1234-5678-1234-567812345678")
|
223
|
-
>>> item = tile.get_item()
|
224
|
-
"""
|
225
|
-
endpoint = f"{self.endpoint}{path}"
|
226
|
-
return self.api.get(endpoint)
|
227
|
-
|
228
|
-
|
229
|
-
def share(self, users: List['User']) -> None:
|
230
|
-
"""
|
231
|
-
Shares the 3D Tile with specified users.
|
232
|
-
|
233
|
-
Args:
|
234
|
-
users (List[User]): The list of user objects to share the 3D Tile with.
|
235
|
-
|
236
|
-
Returns:
|
237
|
-
None
|
238
|
-
|
239
|
-
Example:
|
240
|
-
>>> from geobox import GeoboxClient
|
241
|
-
>>> from geobox.tile3d import Tile3d
|
242
|
-
>>> client = GeoboxClient()
|
243
|
-
>>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
244
|
-
>>> users = client.search_users(search='John')
|
245
|
-
>>> tile.share(users=users)
|
246
|
-
"""
|
247
|
-
super()._share(self.endpoint, users)
|
248
|
-
|
249
|
-
|
250
|
-
def unshare(self, users: List['User']) -> None:
|
251
|
-
"""
|
252
|
-
Unshares the 3D Tile with specified users.
|
253
|
-
|
254
|
-
Args:
|
255
|
-
users (List[User]): The list of user objects to unshare the 3D Tile with.
|
256
|
-
|
257
|
-
Returns:
|
258
|
-
None
|
259
|
-
|
260
|
-
Example:
|
261
|
-
>>> from geobox import GeoboxClient
|
262
|
-
>>> from geobox.tile3d import Tile3d
|
263
|
-
>>> client = GeoboxClient()
|
264
|
-
>>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
265
|
-
>>> users = client.search_users(search='John')
|
266
|
-
>>> tile.unshare(users=users)
|
267
|
-
"""
|
268
|
-
super()._unshare(self.endpoint, users)
|
269
|
-
|
270
|
-
|
271
|
-
def get_shared_users(self, search: str = None, skip: int = 0, limit: int = 10) -> List['User']:
|
272
|
-
"""
|
273
|
-
Retrieves the list of users the 3D Tile is shared with.
|
274
|
-
|
275
|
-
Args:
|
276
|
-
search (str, optional): The search query.
|
277
|
-
skip (int, optional): The number of users to skip.
|
278
|
-
limit (int, optional): The maximum number of users to retrieve.
|
279
|
-
|
280
|
-
Returns:
|
281
|
-
List[User]: The list of shared users.
|
282
|
-
|
283
|
-
Example:
|
284
|
-
>>> from geobox import GeoboxClient
|
285
|
-
>>> from geobox.tile3d import Tile3d
|
286
|
-
>>> client = GeoboxClient()
|
287
|
-
>>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
288
|
-
>>> tile.get_shared_users(search='John', skip=0, limit=10)
|
289
|
-
"""
|
290
|
-
params = {
|
291
|
-
'search': search,
|
292
|
-
'skip': skip,
|
293
|
-
'limit': limit
|
294
|
-
}
|
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
|
+
|
9
|
+
|
10
|
+
class Tile3d(Base):
|
11
|
+
|
12
|
+
BASE_ENDPOINT = '3dtiles/'
|
13
|
+
|
14
|
+
def __init__(self,
|
15
|
+
api: 'GeoboxClient',
|
16
|
+
uuid: str,
|
17
|
+
data: Optional[Dict] = {}):
|
18
|
+
"""
|
19
|
+
Initialize a 3D Tile instance.
|
20
|
+
|
21
|
+
Args:
|
22
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
23
|
+
name (str): The name of the 3D Tile.
|
24
|
+
uuid (str): The unique identifier for the 3D Tile.
|
25
|
+
data (Dict): The data of the 3D Tile.
|
26
|
+
"""
|
27
|
+
super().__init__(api, uuid=uuid, data=data)
|
28
|
+
|
29
|
+
|
30
|
+
@classmethod
|
31
|
+
def get_3dtiles(cls, api: 'GeoboxClient', **kwargs) -> Union[List['Tile3d'], int]:
|
32
|
+
"""
|
33
|
+
Get list of 3D Tiles with optional filtering and pagination.
|
34
|
+
|
35
|
+
Args:
|
36
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
37
|
+
|
38
|
+
Keyword Args:
|
39
|
+
q (str): query filter based on OGC CQL standard. e.g. "field1 LIKE '%GIS%' AND created_at > '2021-01-01'"
|
40
|
+
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.
|
41
|
+
search_fields (str): comma separated list of fields for searching.
|
42
|
+
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.
|
43
|
+
return_count (bool): Whether to return total count. default is False.
|
44
|
+
skip (int): Number of items to skip. default is 0.
|
45
|
+
limit (int): Number of items to return. default is 10.
|
46
|
+
user_id (int): Specific user. privileges required.
|
47
|
+
shared (bool): Whether to return shared maps. default is False.
|
48
|
+
|
49
|
+
Returns:
|
50
|
+
List[Tile3d] | int: A list of 3D Tile instances or the total number of 3D Tiles.
|
51
|
+
|
52
|
+
Example:
|
53
|
+
>>> from geobox import GeoboxClient
|
54
|
+
>>> from geobox.tile3d import Tile3d
|
55
|
+
>>> client = GeoboxClient()
|
56
|
+
>>> tiles = Tile3d.get_3dtiles(client, q="name LIKE '%My tile%'")
|
57
|
+
or
|
58
|
+
>>> tiles = client.get_3dtiles(q="name LIKE '%My tile%'")
|
59
|
+
"""
|
60
|
+
params = {
|
61
|
+
'f': 'json',
|
62
|
+
'q': kwargs.get('q'),
|
63
|
+
'search': kwargs.get('search'),
|
64
|
+
'search_fields': kwargs.get('search_fields'),
|
65
|
+
'order_by': kwargs.get('order_by'),
|
66
|
+
'return_count': kwargs.get('return_count', False),
|
67
|
+
'skip': kwargs.get('skip', 0),
|
68
|
+
'limit': kwargs.get('limit', 10),
|
69
|
+
'user_id': kwargs.get('user_id'),
|
70
|
+
'shared': kwargs.get('shared', False)
|
71
|
+
}
|
72
|
+
return super()._get_list(api, cls.BASE_ENDPOINT, params, factory_func=lambda api, item: Tile3d(api, item['uuid'], item))
|
73
|
+
|
74
|
+
|
75
|
+
@classmethod
|
76
|
+
def get_3dtile(cls, api: 'GeoboxClient', uuid: str, user_id: int = None) -> 'Tile3d':
|
77
|
+
"""
|
78
|
+
Get a 3D Tile by its UUID.
|
79
|
+
|
80
|
+
Args:
|
81
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
82
|
+
uuid (str): The UUID of the map to 3D Tile.
|
83
|
+
user_id (int): Specific user. privileges required.
|
84
|
+
|
85
|
+
Returns:
|
86
|
+
Tile3d: The 3D Tile object.
|
87
|
+
|
88
|
+
Raises:
|
89
|
+
NotFoundError: If the 3D Tile with the specified UUID is not found.
|
90
|
+
|
91
|
+
Example:
|
92
|
+
>>> from geobox import GeoboxClient
|
93
|
+
>>> from geobox.tile3d import Tile3d
|
94
|
+
>>> client = GeoboxClient()
|
95
|
+
>>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
96
|
+
or
|
97
|
+
>>> tile = client.get_3dtile(uuid="12345678-1234-5678-1234-567812345678")
|
98
|
+
"""
|
99
|
+
params = {
|
100
|
+
'f': 'json',
|
101
|
+
'user_id': user_id,
|
102
|
+
}
|
103
|
+
return super()._get_detail(api, cls.BASE_ENDPOINT, uuid, params, factory_func=lambda api, item: Tile3d(api, item['uuid'], item))
|
104
|
+
|
105
|
+
|
106
|
+
@classmethod
|
107
|
+
def get_3dtile_by_name(cls, api: 'GeoboxClient', name: str, user_id: int = None) -> Union['Tile3d', None]:
|
108
|
+
"""
|
109
|
+
Get a 3dtile by name
|
110
|
+
|
111
|
+
Args:
|
112
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
113
|
+
name (str): the name of the 3dtile to get
|
114
|
+
user_id (int, optional): specific user. privileges required.
|
115
|
+
|
116
|
+
Returns:
|
117
|
+
Tile3d | None: returns the 3dtile if a 3dtile matches the given name, else None
|
118
|
+
|
119
|
+
Example:
|
120
|
+
>>> from geobox import GeoboxClient
|
121
|
+
>>> from geobox.tile3d import Tile3d
|
122
|
+
>>> client = GeoboxClient()
|
123
|
+
>>> tile3d = Tile3d.get_3dtile_by_name(client, name='test')
|
124
|
+
or
|
125
|
+
>>> tile3d = client.get_3dtile_by_name(name='test')
|
126
|
+
"""
|
127
|
+
tile3ds = cls.get_3dtiles(api, q=f"name = '{name}'", user_id=user_id)
|
128
|
+
if tile3ds and tile3ds[0].name == name:
|
129
|
+
return tile3ds[0]
|
130
|
+
else:
|
131
|
+
return None
|
132
|
+
|
133
|
+
|
134
|
+
def update(self, **kwargs) -> Dict:
|
135
|
+
"""
|
136
|
+
Update the 3D Tile.
|
137
|
+
|
138
|
+
Keyword Args:
|
139
|
+
name (str): The name of the 3D Tile.
|
140
|
+
display_name (str): The display name of the 3D Tile.
|
141
|
+
description (str): The description of the 3D Tile.
|
142
|
+
settings (Dict): The settings of the 3D Tile.
|
143
|
+
thumbnail (str): The thumbnail of the 3D Tile.
|
144
|
+
|
145
|
+
Returns:
|
146
|
+
Dict: The updated 3D Tile data.
|
147
|
+
|
148
|
+
Raises:
|
149
|
+
ApiRequestError: If the API request fails.
|
150
|
+
ValidationError: If the 3D Tile data is invalid.
|
151
|
+
|
152
|
+
Example:
|
153
|
+
>>> from geobox import GeoboxClient
|
154
|
+
>>> from geobox.tile3d import Tile3d
|
155
|
+
>>> client = GeoboxClient()
|
156
|
+
>>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
157
|
+
>>> tile.update_3dtile(display_name="New Display Name")
|
158
|
+
"""
|
159
|
+
data = {
|
160
|
+
"name": kwargs.get('name'),
|
161
|
+
"display_name": kwargs.get('display_name'),
|
162
|
+
"description": kwargs.get('description'),
|
163
|
+
"settings": kwargs.get('settings'),
|
164
|
+
"thumbnail": kwargs.get('thumbnail'),
|
165
|
+
}
|
166
|
+
return super()._update(self.endpoint, data)
|
167
|
+
|
168
|
+
|
169
|
+
def delete(self) -> None:
|
170
|
+
"""
|
171
|
+
Delete the 3D Tile.
|
172
|
+
|
173
|
+
Returns:
|
174
|
+
None
|
175
|
+
|
176
|
+
Example:
|
177
|
+
>>> from geobox import GeoboxClient
|
178
|
+
>>> from geobox.tile3d import Tile3d
|
179
|
+
>>> client = GeoboxClient()
|
180
|
+
>>> tile = Map.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
181
|
+
>>> tile.delete()
|
182
|
+
"""
|
183
|
+
super().delete(self.endpoint)
|
184
|
+
|
185
|
+
|
186
|
+
@property
|
187
|
+
def thumbnail(self) -> str:
|
188
|
+
"""
|
189
|
+
Get the thumbnail URL of the 3D Tile.
|
190
|
+
|
191
|
+
Returns:
|
192
|
+
str: The thumbnail url of the 3D Tile.
|
193
|
+
|
194
|
+
Example:
|
195
|
+
>>> from geobox import GeoboxClient
|
196
|
+
>>> from geobox.tile3d import Tile3d
|
197
|
+
>>> client = GeoboxClient()
|
198
|
+
>>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
199
|
+
>>> tile.thumbnail
|
200
|
+
'https://example.com/thumbnail.png'
|
201
|
+
"""
|
202
|
+
endpoint = urljoin(self.api.base_url, f'{self.endpoint}thumbnail.png')
|
203
|
+
return endpoint
|
204
|
+
|
205
|
+
|
206
|
+
def get_item(self, path: str) -> Dict:
|
207
|
+
"""
|
208
|
+
Get an Item from 3D Tiles
|
209
|
+
|
210
|
+
Args:
|
211
|
+
path (str): the path of the item.
|
212
|
+
|
213
|
+
Returns:
|
214
|
+
Dict: the data of the item.
|
215
|
+
|
216
|
+
Example:
|
217
|
+
>>> from geobox imoprt GeoboxClient
|
218
|
+
>>> from geobox.tile3d import Tile3d
|
219
|
+
>>> client = GeoboxClient()
|
220
|
+
>>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
221
|
+
or
|
222
|
+
>>> tile = client.get_3dtile(uuid="12345678-1234-5678-1234-567812345678")
|
223
|
+
>>> item = tile.get_item()
|
224
|
+
"""
|
225
|
+
endpoint = f"{self.endpoint}{path}"
|
226
|
+
return self.api.get(endpoint)
|
227
|
+
|
228
|
+
|
229
|
+
def share(self, users: List['User']) -> None:
|
230
|
+
"""
|
231
|
+
Shares the 3D Tile with specified users.
|
232
|
+
|
233
|
+
Args:
|
234
|
+
users (List[User]): The list of user objects to share the 3D Tile with.
|
235
|
+
|
236
|
+
Returns:
|
237
|
+
None
|
238
|
+
|
239
|
+
Example:
|
240
|
+
>>> from geobox import GeoboxClient
|
241
|
+
>>> from geobox.tile3d import Tile3d
|
242
|
+
>>> client = GeoboxClient()
|
243
|
+
>>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
244
|
+
>>> users = client.search_users(search='John')
|
245
|
+
>>> tile.share(users=users)
|
246
|
+
"""
|
247
|
+
super()._share(self.endpoint, users)
|
248
|
+
|
249
|
+
|
250
|
+
def unshare(self, users: List['User']) -> None:
|
251
|
+
"""
|
252
|
+
Unshares the 3D Tile with specified users.
|
253
|
+
|
254
|
+
Args:
|
255
|
+
users (List[User]): The list of user objects to unshare the 3D Tile with.
|
256
|
+
|
257
|
+
Returns:
|
258
|
+
None
|
259
|
+
|
260
|
+
Example:
|
261
|
+
>>> from geobox import GeoboxClient
|
262
|
+
>>> from geobox.tile3d import Tile3d
|
263
|
+
>>> client = GeoboxClient()
|
264
|
+
>>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
265
|
+
>>> users = client.search_users(search='John')
|
266
|
+
>>> tile.unshare(users=users)
|
267
|
+
"""
|
268
|
+
super()._unshare(self.endpoint, users)
|
269
|
+
|
270
|
+
|
271
|
+
def get_shared_users(self, search: str = None, skip: int = 0, limit: int = 10) -> List['User']:
|
272
|
+
"""
|
273
|
+
Retrieves the list of users the 3D Tile is shared with.
|
274
|
+
|
275
|
+
Args:
|
276
|
+
search (str, optional): The search query.
|
277
|
+
skip (int, optional): The number of users to skip.
|
278
|
+
limit (int, optional): The maximum number of users to retrieve.
|
279
|
+
|
280
|
+
Returns:
|
281
|
+
List[User]: The list of shared users.
|
282
|
+
|
283
|
+
Example:
|
284
|
+
>>> from geobox import GeoboxClient
|
285
|
+
>>> from geobox.tile3d import Tile3d
|
286
|
+
>>> client = GeoboxClient()
|
287
|
+
>>> tile = Tile3d.get_3dtile(client, uuid="12345678-1234-5678-1234-567812345678")
|
288
|
+
>>> tile.get_shared_users(search='John', skip=0, limit=10)
|
289
|
+
"""
|
290
|
+
params = {
|
291
|
+
'search': search,
|
292
|
+
'skip': skip,
|
293
|
+
'limit': limit
|
294
|
+
}
|
295
295
|
return super()._get_shared_users(self.endpoint, params)
|