geobox 2.2.6__py3-none-any.whl → 2.4.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 (65) hide show
  1. geobox/aio/api.py +265 -6
  2. geobox/aio/apikey.py +0 -26
  3. geobox/aio/attachment.py +5 -31
  4. geobox/aio/basemap.py +2 -30
  5. geobox/aio/dashboard.py +0 -26
  6. geobox/aio/feature.py +172 -17
  7. geobox/aio/field.py +0 -27
  8. geobox/aio/file.py +0 -26
  9. geobox/aio/layout.py +0 -26
  10. geobox/aio/log.py +0 -27
  11. geobox/aio/map.py +0 -26
  12. geobox/aio/model3d.py +0 -26
  13. geobox/aio/mosaic.py +0 -26
  14. geobox/aio/plan.py +0 -26
  15. geobox/aio/query.py +0 -26
  16. geobox/aio/raster.py +0 -26
  17. geobox/aio/scene.py +1 -26
  18. geobox/aio/settings.py +0 -28
  19. geobox/aio/table.py +1733 -0
  20. geobox/aio/task.py +0 -27
  21. geobox/aio/tile3d.py +0 -26
  22. geobox/aio/tileset.py +1 -26
  23. geobox/aio/usage.py +0 -32
  24. geobox/aio/user.py +0 -59
  25. geobox/aio/vector_tool.py +49 -0
  26. geobox/aio/vectorlayer.py +8 -34
  27. geobox/aio/version.py +1 -25
  28. geobox/aio/view.py +5 -35
  29. geobox/aio/workflow.py +0 -26
  30. geobox/api.py +265 -5
  31. geobox/apikey.py +0 -26
  32. geobox/attachment.py +0 -26
  33. geobox/basemap.py +0 -28
  34. geobox/dashboard.py +0 -26
  35. geobox/enums.py +15 -1
  36. geobox/feature.py +170 -15
  37. geobox/field.py +20 -37
  38. geobox/file.py +0 -26
  39. geobox/layout.py +0 -26
  40. geobox/log.py +0 -26
  41. geobox/map.py +0 -26
  42. geobox/model3d.py +0 -26
  43. geobox/mosaic.py +0 -26
  44. geobox/plan.py +1 -26
  45. geobox/query.py +1 -26
  46. geobox/raster.py +1 -31
  47. geobox/scene.py +1 -27
  48. geobox/settings.py +1 -29
  49. geobox/table.py +1719 -0
  50. geobox/task.py +2 -29
  51. geobox/tile3d.py +0 -26
  52. geobox/tileset.py +1 -26
  53. geobox/usage.py +2 -33
  54. geobox/user.py +1 -59
  55. geobox/vector_tool.py +49 -0
  56. geobox/vectorlayer.py +9 -36
  57. geobox/version.py +1 -26
  58. geobox/view.py +4 -34
  59. geobox/workflow.py +1 -26
  60. {geobox-2.2.6.dist-info → geobox-2.4.0.dist-info}/METADATA +2 -2
  61. geobox-2.4.0.dist-info/RECORD +74 -0
  62. {geobox-2.2.6.dist-info → geobox-2.4.0.dist-info}/WHEEL +1 -1
  63. geobox-2.2.6.dist-info/RECORD +0 -72
  64. {geobox-2.2.6.dist-info → geobox-2.4.0.dist-info}/licenses/LICENSE +0 -0
  65. {geobox-2.2.6.dist-info → geobox-2.4.0.dist-info}/top_level.txt +0 -0
geobox/aio/task.py CHANGED
@@ -14,7 +14,6 @@ if TYPE_CHECKING:
14
14
  from .model3d import AsyncModel
15
15
  from .file import AsyncFile
16
16
  from .tile3d import AsyncTile3d
17
- from ..api import GeoboxClient
18
17
  from ..task import Task
19
18
 
20
19
  logger = logging.getLogger(__name__)
@@ -379,29 +378,3 @@ class AsyncTask(AsyncBase):
379
378
  >>> task = await client.get_task(uuid="12345678-1234-5678-1234-567812345678")
380
379
  """
381
380
  return await super()._get_detail(api, cls.BASE_ENDPOINT, uuid, factory_func=lambda api, item: AsyncTask(api, item['uuid'], item))
382
-
383
-
384
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Task':
385
- """
386
- Switch to sync version of the task instance to have access to the sync methods
387
-
388
- Args:
389
- sync_client (SyncGeoboxClient): The sync version of the GeoboxClient instance for making requests.
390
-
391
- Returns:
392
- Task: the sync instance of the task.
393
-
394
- Example:
395
- >>> from geobox import Geoboxclient
396
- >>> from geobox.aio import AsyncGeoboxClient
397
- >>> from geobox.aio.task import AsyncTask
398
- >>> client = GeoboxClient()
399
- >>> async with AsyncGeoboxClient() as async_client:
400
- >>> task = await AsyncTask.get_task(async_client, uuid="12345678-1234-5678-1234-567812345678")
401
- or
402
- >>> task = await async_client.get_task(uuid="12345678-1234-5678-1234-567812345678")
403
- >>> sync_task = task.to_sync(client)
404
- """
405
- from ..task import Task
406
-
407
- return Task(api=sync_client, uuid=self.uuid, data=self.data)
geobox/aio/tile3d.py CHANGED
@@ -6,8 +6,6 @@ from .base import AsyncBase
6
6
  if TYPE_CHECKING:
7
7
  from . import AsyncGeoboxClient
8
8
  from .user import AsyncUser
9
- from ..api import GeoboxClient
10
- from ..tile3d import Tile3d
11
9
 
12
10
 
13
11
  class AsyncTile3d(AsyncBase):
@@ -311,27 +309,3 @@ class AsyncTile3d(AsyncBase):
311
309
  """
312
310
  endpoint = urljoin(self.endpoint, 'tileset.json')
313
311
  return await self.api.get(endpoint)
314
-
315
-
316
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Tile3d':
317
- """
318
- Switch to sync version of the 3d tile instance to have access to the sync methods
319
-
320
- Args:
321
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
322
-
323
- Returns:
324
- Tile3d: the sync instance of the 3d tile.
325
-
326
- Example:
327
- >>> from geobox import Geoboxclient
328
- >>> from geobox.aio import AsyncGeoboxClient
329
- >>> from geobox.aio.tile3d import AsyncTile3d
330
- >>> client = GeoboxClient()
331
- >>> async with AsyncGeoboxClient() as async_client:
332
- >>> tile = await AsyncTile3d.get_3dtile(api=async_client, uuid="12345678-1234-5678-1234-567812345678")
333
- >>> sync_tile = tile.to_sync(client)
334
- """
335
- from ..tile3d import Tile3d
336
-
337
- return Tile3d(api=sync_client, uuid=self.uuid, data=self.data)
geobox/aio/tileset.py CHANGED
@@ -9,8 +9,7 @@ from .task import AsyncTask
9
9
  if TYPE_CHECKING:
10
10
  from . import AsyncGeoboxClient
11
11
  from .user import AsyncUser
12
- from ..api import GeoboxClient
13
- from ..tileset import Tileset
12
+
14
13
 
15
14
  class AsyncTileset(AsyncBase):
16
15
 
@@ -645,27 +644,3 @@ class AsyncTileset(AsyncBase):
645
644
  >>> await tileset.clear_cache()
646
645
  """
647
646
  await super()._clear_cache(endpoint=self.endpoint)
648
-
649
-
650
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Tileset':
651
- """
652
- Switch to sync version of the tileset instance to have access to the sync methods
653
-
654
- Args:
655
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
656
-
657
- Returns:
658
- Tileset: the sync instance of the tileset.
659
-
660
- Example:
661
- >>> from geobox import Geoboxclient
662
- >>> from geobox.aio import AsyncGeoboxClient
663
- >>> from geobox.aio.tileset import AsyncTileset
664
- >>> client = GeoboxClient()
665
- >>> async with AsyncGeoboxClient() as async_client:
666
- >>> tileset = await AsyncTileset.get_tileset(async_client, uuid="12345678-1234-5678-1234-567812345678")
667
- >>> sync_tileset = tileset.to_sync(client)
668
- """
669
- from ..tileset import Tileset
670
-
671
- return Tileset(api=sync_client, uuid=self.uuid, data=self.data)
geobox/aio/usage.py CHANGED
@@ -10,8 +10,6 @@ from ..enums import UsageScale, UsageParam
10
10
 
11
11
  if TYPE_CHECKING:
12
12
  from . import AsyncGeoboxClient
13
- from ..api import GeoboxClient
14
- from ..usage import Usage
15
13
 
16
14
 
17
15
  class AsyncUsage(AsyncBase):
@@ -212,33 +210,3 @@ class AsyncUsage(AsyncBase):
212
210
  })
213
211
  endpoint = f"{cls.BASE_ENDPOINT}update"
214
212
  return await api.post(endpoint, payload=data)
215
-
216
-
217
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Usage':
218
- """
219
- Switch to sync version of the usage instance to have access to the sync methods
220
-
221
- Args:
222
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
223
-
224
- Returns:
225
- Usage: the sync instance of the usage.
226
-
227
- Example:
228
- >>> from geobox import Geoboxclient
229
- >>> from geobox.aio import AsyncGeoboxClient
230
- >>> from geobox.aio.usage import AsyncUsage
231
- >>> client = GeoboxClient()
232
- >>> async with AsyncGeoboxClient() as async_client:
233
- >>> user = await async_client.get_user()
234
- >>> usage = await AsyncUsage.get_api_usage(async_client,
235
- ... resource=user,
236
- ... scale=UsageScale.Day,
237
- ... param=UsageParam.Calls,
238
- ... days_before_now=5)
239
- >>> sync_usage = await usage.to_sync(client)
240
- """
241
- from ..usage import Usage
242
-
243
- user = self.user.to_sync(sync_client)
244
- return Usage(api=sync_client, user=user)
geobox/aio/user.py CHANGED
@@ -8,9 +8,6 @@ from .plan import AsyncPlan
8
8
 
9
9
  if TYPE_CHECKING:
10
10
  from . import AsyncGeoboxClient
11
- from ..api import GeoboxClient
12
- from ..api import User
13
- from ..api import Session
14
11
 
15
12
 
16
13
  class AsyncUser(AsyncBase):
@@ -399,33 +396,6 @@ class AsyncUser(AsyncBase):
399
396
  await self.api.post(endpoint)
400
397
 
401
398
 
402
- def to_sync(self, sync_client: 'GeoboxClient') -> 'User':
403
- """
404
- Switch to sync version of the user instance to have access to the sync methods
405
-
406
- Args:
407
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
408
-
409
- Returns:
410
- User: the async instance of the user.
411
-
412
- Example:
413
- >>> from geobox import Geoboxclient
414
- >>> from geobox.aio import AsyncGeoboxClient
415
- >>> from geobox.aio.user import AsyncUser
416
- >>> client = GeoboxClient()
417
- >>> async with AsyncGeoboxClient() as async_client:
418
- >>> user = await AsyncUser.get_user(async_client) # without user_id parameter, it gets the current user
419
- or
420
- >>> user = await async_client.get_user() # without user_id parameter, it gets the current user
421
- >>> sync_user = user.to_sync(client)
422
- """
423
- from ..user import User
424
-
425
- return User(api=sync_client, user_id=self.user_id, data=self.data)
426
-
427
-
428
-
429
399
  class AsyncSession(AsyncBase):
430
400
  def __init__(self, uuid: str, data: Dict, user: 'AsyncUser'):
431
401
  """
@@ -475,32 +445,3 @@ class AsyncSession(AsyncBase):
475
445
  'session_uuid': self.uuid
476
446
  })
477
447
  await self.user.api.post(self.endpoint, data)
478
-
479
-
480
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Session':
481
- """
482
- Switch to sync version of the session instance to have access to the sync methods
483
-
484
- Args:
485
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
486
-
487
- Returns:
488
- Session: the sync instance of the session.
489
-
490
- Example:
491
- >>> from geobox import Geoboxclient
492
- >>> from geobox.aio import AsyncGeoboxClient
493
- >>> from geobox.aio.user import AsyncUser
494
- >>> client = GeoboxClient()
495
- >>> async with AsyncGeoboxClient() as async_client:
496
- >>> user = await AsyncUser.get_user(async_client) # without user_id parameter, it gets the current user
497
- or
498
- >>> user = await async_client.get_user() # without user_id parameter, it gets the current user
499
- >>> sessions = await user.get_sessions()
500
- >>> session = sessions[0]
501
- >>> sync_session = session.to_sync(client)
502
- """
503
- from ..user import Session
504
-
505
- sync_user = self.user.to_sync(sync_client)
506
- return Session(uuid=self.uuid, data=self.data, user=sync_user)
geobox/aio/vector_tool.py CHANGED
@@ -1965,4 +1965,53 @@ class AsyncVectorTool(AsyncBase):
1965
1965
  'srid': srid
1966
1966
  }
1967
1967
  query = await self._add_params_to_query(query_name='$xy_coordinate', inputs=inputs)
1968
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1969
+
1970
+
1971
+ async def table_to_vectorlayer(self,
1972
+ table_uuid: str,
1973
+ lon_field: str,
1974
+ lat_field: str,
1975
+ output_layer_name: Optional[str] = None,
1976
+ ) -> Union['AsyncTask', Dict]:
1977
+ """
1978
+ [async] Converts a table to a vector layer by converting the lon and lat columns to a point geometry.
1979
+
1980
+ Args:
1981
+ table_uuid (str): UUID of the vector layer
1982
+ lon_field (str): field name containing lon value
1983
+ lat_field (str): field name containing lat value
1984
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1985
+
1986
+ Returns:
1987
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1988
+
1989
+ Example:
1990
+ >>> from geobox.aio import AsyncGeoboxClient
1991
+ >>> async with AsyncGeoboxClient() as client:
1992
+ >>> table = await client.get_table(uuid="12345678-1234-5678-1234-567812345678")
1993
+
1994
+ >>> # execution
1995
+ >>> result = await client.vector_tool.table_to_vectorlayer(
1996
+ ... table_uuid=table.uuid,
1997
+ ... lon_field="lon_field_name",
1998
+ ... lat_field="lat_field_name",
1999
+ ... )
2000
+
2001
+ >>> # save as layer
2002
+ >>> task = await client.vector_tool.table_to_vectorlayer(
2003
+ ... table_uuid=table.uuid,
2004
+ ... lon_field="lon_field_name",
2005
+ ... lat_field="lat_field_name",
2006
+ ... output_layer_name="output_layer",
2007
+ ... )
2008
+ >>> task.wait()
2009
+ >>> output_layer = task.output_asset
2010
+ """
2011
+ inputs = {
2012
+ 'table': table_uuid,
2013
+ 'lon': lon_field,
2014
+ 'lat': lat_field,
2015
+ }
2016
+ query = await self._add_params_to_query(query_name='$tabel_to_vector_layer', inputs=inputs)
1968
2017
  return await self._run_query(query=query, output_layer_name=output_layer_name)
geobox/aio/vectorlayer.py CHANGED
@@ -16,8 +16,6 @@ if TYPE_CHECKING:
16
16
  from .user import AsyncUser
17
17
  from .file import AsyncFile
18
18
  from .attachment import AsyncAttachment
19
- from ..api import GeoboxClient
20
- from ..vectorlayer import VectorLayer
21
19
 
22
20
 
23
21
  class AsyncVectorLayer(AsyncBase):
@@ -667,6 +665,8 @@ class AsyncVectorLayer(AsyncBase):
667
665
  If False, returns a list of Feature objects. default: False.
668
666
 
669
667
  Keyword Args:
668
+ relationship_uuid (str): The uuid of relationship
669
+ related_record_id (int): This is the id of the feature or row that these features are related to. This id blongs to the related layer or table not this layer
670
670
  quant_factor (int): Quantization factor. This parameter is only used by topojson encoder and is ignored for other formats. Higher quantizaion value means higher geometry precision. default is 1000000.
671
671
  skip (int): Number of features to skip. default is 0.
672
672
  limit (int): Maximum number of features to return. default is 100.
@@ -704,6 +704,8 @@ class AsyncVectorLayer(AsyncBase):
704
704
  """
705
705
  params = {
706
706
  'f': 'json',
707
+ 'relationship_uuid': kwargs.get('relationship_uuid'),
708
+ 'related_record_id': kwargs.get('related_record_id'),
707
709
  'quant_factor': kwargs.get('quant_factor', 1000000),
708
710
  'skip': kwargs.get('skip', 0),
709
711
  'limit': kwargs.get('limit', 100),
@@ -1032,14 +1034,10 @@ class AsyncVectorLayer(AsyncBase):
1032
1034
  factory_func=lambda api, item: AsyncVectorLayerView(api, item['uuid'], self.layer_type, item))
1033
1035
 
1034
1036
 
1035
- def get_tile_pbf_url(self, x: int = '{x}', y: int = '{y}', z: int = '{z}') -> str:
1037
+ @property
1038
+ def tile_pbf_url(self) -> str:
1036
1039
  """
1037
1040
  Get a vector tile pbf url for the layer.
1038
-
1039
- Args:
1040
- x (int, optional): X coordinate of the tile.
1041
- y (int, optional): Y coordinate of the tile.
1042
- z (int, optioanl): Zoom level of the tile.
1043
1041
 
1044
1042
  Returns:
1045
1043
  str: The vector tile url.
@@ -1049,9 +1047,9 @@ class AsyncVectorLayer(AsyncBase):
1049
1047
  >>> from geobox.aio.vectorlayer import AsyncVectorLayer
1050
1048
  >>> async with AsyncGeoboxClient() as client:
1051
1049
  >>> layer = await AsyncVectorLayer.get_vector(api=client, uuid="12345678-1234-5678-1234-567812345678")
1052
- >>> tile = layer.get_tile(x=10, y=20, z=1)
1050
+ >>> url = layer.tile_pbf_url
1053
1051
  """
1054
- endpoint = f'{self.api.base_url}{self.endpoint}tiles/{z}/{x}/{y}.pbf'
1052
+ endpoint = f'{self.api.base_url}{self.endpoint}' + 'tiles/{z}/{x}/{y}.pbf'
1055
1053
 
1056
1054
  if not self.api.access_token and self.api.apikey:
1057
1055
  endpoint = f'{endpoint}?apikey={self.api.apikey}'
@@ -1356,27 +1354,3 @@ class AsyncVectorLayer(AsyncBase):
1356
1354
  feature=feature,
1357
1355
  display_name=display_name,
1358
1356
  description=description)
1359
-
1360
-
1361
- def to_sync(self, sync_client: 'GeoboxClient') -> 'VectorLayer':
1362
- """
1363
- Switch to sync version of the vector layer instance to have access to the sync methods
1364
-
1365
- Args:
1366
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
1367
-
1368
- Returns:
1369
- VectorLayer: the sync instance of the vector layer.
1370
-
1371
- Example:
1372
- >>> from geobox import Geoboxclient
1373
- >>> from geobox.aio import AsyncGeoboxClient
1374
- >>> from geobox.aio.vectorlayer import AsyncVectorLayer
1375
- >>> client = GeoboxClient()
1376
- >>> async with AsyncGeoboxClient() as async_client:
1377
- >>> layer = await AsyncVectorLayer.get_vector(async_client, uuid="12345678-1234-5678-1234-567812345678")
1378
- >>> sync_layer = layer.to_sync(client)
1379
- """
1380
- from ..vectorlayer import VectorLayer
1381
-
1382
- return VectorLayer(api=sync_client, uuid=self.uuid, layer_type=self.layer_type, data=self.data)
geobox/aio/version.py CHANGED
@@ -5,8 +5,7 @@ from .base import AsyncBase
5
5
  if TYPE_CHECKING:
6
6
  from .api import AsyncGeoboxClient
7
7
  from .user import AsyncUser
8
- from ..api import GeoboxClient
9
- from ..version import VectorLayerVersion
8
+
10
9
 
11
10
  class AsyncVectorLayerVersion(AsyncBase):
12
11
 
@@ -247,26 +246,3 @@ class AsyncVectorLayerVersion(AsyncBase):
247
246
  'limit': limit
248
247
  }
249
248
  return await super()._get_shared_users(self.endpoint, params)
250
-
251
-
252
- def to_sync(self, sync_client: 'GeoboxClient') -> 'VectorLayerVersion':
253
- """
254
- Switch to sync version of the version instance to have access to the sync methods
255
-
256
- Args:
257
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
258
-
259
- Returns:
260
- VectorLayerVersion: the sync instance of the version.
261
-
262
- Example:
263
- >>> from geobox import Geoboxclient
264
- >>> from geobox.aio import AsyncGeoboxClient
265
- >>> client = GeoboxClient()
266
- >>> async with AsyncGeoboxClient() as async_client:
267
- >>> version = await async_client.get_version(async_client, uuid="12345678-1234-5678-1234-567812345678")
268
- >>> sync_version = version.to_sync(client)
269
- """
270
- from ..version import VectorLayerVersion
271
-
272
- return VectorLayerVersion(api=sync_client, uuid=self.uuid, data=self.data)
geobox/aio/view.py CHANGED
@@ -11,8 +11,6 @@ if TYPE_CHECKING:
11
11
  from .file import AsyncFile
12
12
  from .attachment import AsyncAttachment
13
13
  from ..enums import InputGeomType
14
- from ..api import GeoboxClient
15
- from ..view import VectorLayerView
16
14
 
17
15
 
18
16
  class AsyncVectorLayerView(AsyncVectorLayer):
@@ -701,14 +699,10 @@ class AsyncVectorLayerView(AsyncVectorLayer):
701
699
  fields)
702
700
 
703
701
 
704
- def get_tile_pbf_url(self, x: int = '{x}', y: int = '{y}', z: int = '{z}') -> str:
702
+ @property
703
+ def tile_pbf_url(self) -> str:
705
704
  """
706
705
  Get a vector tile pbf url for the view.
707
-
708
- Args:
709
- x (int): X coordinate of the tile.
710
- y (int): Y coordinate of the tile.
711
- z (int): Zoom level of the tile.
712
706
 
713
707
  Returns:
714
708
  str: the vector tile url.
@@ -718,9 +712,9 @@ class AsyncVectorLayerView(AsyncVectorLayer):
718
712
  >>> from geobox.aio.view import AsyncVectorLayerView
719
713
  >>> async with AsyncGeoboxClient() as client:
720
714
  >>> view = await AsyncVectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678")
721
- >>> tile = view.get_tile(x=10, y=20, z=1)
715
+ >>> url = view.tile_pbf_url
722
716
  """
723
- return super().get_tile_pbf_url(x, y, z)
717
+ return super().tile_pbf_url
724
718
 
725
719
 
726
720
  async def get_tile_json(self) -> Dict:
@@ -958,7 +952,7 @@ class AsyncVectorLayerView(AsyncVectorLayer):
958
952
  file: 'AsyncFile',
959
953
  feature: 'AsyncFeature' = None,
960
954
  display_name: str = None,
961
- description: str = None) -> 'Attachment':
955
+ description: str = None) -> 'AsyncAttachment':
962
956
  """
963
957
  [async] Create a new Attachment.
964
958
 
@@ -997,27 +991,3 @@ class AsyncVectorLayerView(AsyncVectorLayer):
997
991
  feature=feature,
998
992
  display_name=display_name,
999
993
  description=description)
1000
-
1001
-
1002
- def to_sync(self, sync_client: 'GeoboxClient') -> 'VectorLayerView':
1003
- """
1004
- Switch to sync version of the view instance to have access to the sync methods
1005
-
1006
- Args:
1007
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
1008
-
1009
- Returns:
1010
- VectorLayerView: the sync instance of the view.
1011
-
1012
- Example:
1013
- >>> from geobox import Geoboxclient
1014
- >>> from geobox.aio import AsyncGeoboxClient
1015
- >>> from geobox.aio.view import AsyncVectorLayerView
1016
- >>> client = GeoboxClient()
1017
- >>> async with AsyncGeoboxClient() as async_client:
1018
- >>> view = await AsyncVectorLayerView.get_view(async_client, uuid="12345678-1234-5678-1234-567812345678")
1019
- >>> sync_view = view.to_sync(client)
1020
- """
1021
- from ..view import VectorLayerView
1022
-
1023
- return VectorLayerView(api=sync_client, uuid=self.uuid, layer_type=self.layer_type, data=self.data)
geobox/aio/workflow.py CHANGED
@@ -5,8 +5,6 @@ from .base import AsyncBase
5
5
  if TYPE_CHECKING:
6
6
  from . import AsyncGeoboxClient
7
7
  from .user import AsyncUser
8
- from ..api import GeoboxClient
9
- from ..workflow import Workflow
10
8
 
11
9
 
12
10
  class AsyncWorkflow(AsyncBase):
@@ -314,27 +312,3 @@ class AsyncWorkflow(AsyncBase):
314
312
  'limit': limit
315
313
  }
316
314
  return await super()._get_shared_users(self.endpoint, params)
317
-
318
-
319
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Workflow':
320
- """
321
- Switch to sync version of the workflow instance to have access to the sync methods
322
-
323
- Args:
324
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
325
-
326
- Returns:
327
- Workflow: the sync instance of the workflow.
328
-
329
- Example:
330
- >>> from geobox import Geoboxclient
331
- >>> from geobox.aio import AsyncGeoboxClient
332
- >>> from geobox.aio.workflow import AsyncWorkflow
333
- >>> client = GeoboxClient()
334
- >>> async with AsyncGeoboxClient() as async_client:
335
- >>> workflow = await AsyncWorkflow.get_workflow(async_client, uuid="12345678-1234-5678-1234-567812345678")
336
- >>> sync_workflow = workflow.to_sync(client)
337
- """
338
- from ..workflow import Workflow
339
-
340
- return Workflow(api=sync_client, uuid=self.uuid, data=self.data)