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/basemap.py CHANGED
@@ -1,195 +1,195 @@
1
- from typing import List, Dict, Optional, TYPE_CHECKING
2
- from urllib.parse import urljoin, urlencode
3
-
4
- from .base import Base
5
- from .exception import NotFoundError
6
- from .utils import clean_data
7
-
8
- if TYPE_CHECKING:
9
- from . import GeoboxClient
10
- from .aio import AsyncGeoboxClient
11
- from .aio.basemap import Basemap as AsyncBasemap
12
-
13
-
14
- class Basemap(Base):
15
-
16
- BASE_ENDPOINT = 'basemaps/'
17
-
18
- def __init__(self,
19
- api: 'GeoboxClient',
20
- data: Optional[Dict] = {}):
21
- """
22
- Initialize a basemap instance.
23
-
24
- Args:
25
- api (GeoboxClient): The GeoboxClient instance for making requests.
26
- data (Dict): The data of the basemap.
27
- """
28
- super().__init__(api, data=data)
29
- self.endpoint = f"{self.BASE_ENDPOINT}{self.data.get('name')}/"
30
-
31
-
32
- @classmethod
33
- def get_basemaps(cls, api: 'GeoboxClient') -> List['Basemap']:
34
- """
35
- Get a list of basemaps
36
-
37
- Args:
38
- api (GeoboxClient): The GeoboxClient instance for making requests.
39
-
40
- Returns:
41
- List[BaseMap]: list of basemaps.
42
-
43
- Example:
44
- >>> from geobox import GeoboxClient
45
- >>> from geobox.basemap import Basemap
46
- >>> client = GeoboxClient()
47
- >>> basemaps = Basemap.get_basemaps(client)
48
- or
49
- >>> basemaps = client.get_basemaps()
50
- """
51
- response = api.get(cls.BASE_ENDPOINT)
52
- if not response:
53
- return []
54
-
55
- items = []
56
- for item in response:
57
- response[item]['name'] = item
58
- items.append(response[item])
59
-
60
- return [cls(api, item) for item in items]
61
-
62
-
63
- @classmethod
64
- def get_basemap(cls, api: 'GeoboxClient', name: str) -> 'Basemap':
65
- """
66
- Get a basemap object
67
-
68
- Args:
69
- api (GeoboxClient): The GeoboxClient instance for making requests.
70
- name: the basemap name
71
-
72
- Returns:
73
- Basemap: the basemap object
74
-
75
- Raises:
76
- NotFoundError: if the base,ap with the specified name not found
77
-
78
- Example:
79
- >>> from geobox import GeoboxClient
80
- >>> from geobox.basemap import Basemap
81
- >>> client = GeoboxClient()
82
- >>> basemap = Basemap.get_basemap(client, name='test')
83
- or
84
- >>> basemap = client.get_basemap(name='test')
85
- """
86
- basemap = [basemap for basemap in cls.get_basemaps(api) if basemap.name == name]
87
- if not basemap:
88
- raise NotFoundError(f'Basemap with name "{name}" not found.')
89
-
90
- return basemap[0]
91
-
92
-
93
- @property
94
- def thumbnail(self) -> str:
95
- """
96
- Get the thumbnail url of the basemap
97
-
98
- Returns:
99
- str: the thumbnail url
100
- """
101
- return super().thumbnail()
102
-
103
-
104
- @property
105
- def wmts(self) -> str:
106
- """
107
- Get the wmts url of the basemap
108
-
109
- Returns:
110
- str: the wmts url
111
- """
112
- endpoint = urljoin(self.api.base_url, f'{self.endpoint}wmts/')
113
-
114
- if not self.api.access_token and self.api.apikey:
115
- endpoint = f"{endpoint}?apikey={self.api.apikey}"
116
-
117
- return endpoint
118
-
119
-
120
- @property
121
- def server_url(self) -> str:
122
- """
123
- Get the server url of the basemap
124
-
125
- Returns:
126
- str: the server url
127
- """
128
- endpoint = f'{self.api.base_url}{self.BASE_ENDPOINT}server_url'
129
- return self.api.get(endpoint)
130
-
131
-
132
- @property
133
- def proxy_url(self) -> str:
134
- """
135
- Get the proxy url of the basemap
136
-
137
- Returns:
138
- str: the proxy url
139
- """
140
- endpoint = f'{self.api.base_url}{self.BASE_ENDPOINT}proxy_url'
141
- return self.api.get(endpoint)
142
-
143
-
144
- @classmethod
145
- def proxy_basemap(cls, api: 'GeoboxClient', url: str) -> None:
146
- """
147
- Proxy the basemap
148
-
149
- Args:
150
- api (GeoboxClient): The GeoboxClient instance for making requests.
151
- url (str): the proxy server url.
152
-
153
- Returns:
154
- None
155
-
156
- Example:
157
- >>> from geobox import GeoboxClient
158
- >>> from geobox.basemap import Basemap
159
- >>> client = GeoboxClient()
160
- >>> Basemap.proxy_basemap(client, url='proxy_server_url')
161
- or
162
- >>> client.proxy_basemap(url='proxy_server_url')
163
- """
164
- param = clean_data({
165
- 'url': url
166
- })
167
- query_string = urlencode(param)
168
- endpoint = urljoin(cls.BASE_ENDPOINT, f"?{query_string}")
169
- api.get(endpoint)
170
-
171
-
172
- def to_async(self, async_client: 'AsyncGeoboxClient') -> 'AsyncBasemap':
173
- """
174
- Switch to async version of the basemap instance to have access to the async methods
175
-
176
- Args:
177
- async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
178
-
179
- Returns:
180
- geobox.aio.basemap.Basemap: the async instance of the basemap.
181
-
182
- Example:
183
- >>> from geobox import Geoboxclient
184
- >>> from geobox.aio import AsyncGeoboxClient
185
- >>> from geobox.basemap import Basemap
186
- >>> client = GeoboxClient()
187
- >>> basemap = Basemap.get_basemap(client, name='test')
188
- or
189
- >>> basemap = client.get_basemap(name='test')
190
- >>> async with AsyncGeoboxClient() as async_client:
191
- >>> async_basemap = basemap.to_async(async_client)
192
- """
193
- from .aio.basemap import Basemap as AsyncBasemap
194
-
1
+ from typing import List, Dict, Optional, TYPE_CHECKING
2
+ from urllib.parse import urljoin, urlencode
3
+
4
+ from .base import Base
5
+ from .exception import NotFoundError
6
+ from .utils import clean_data
7
+
8
+ if TYPE_CHECKING:
9
+ from . import GeoboxClient
10
+ from .aio import AsyncGeoboxClient
11
+ from .aio.basemap import AsyncBasemap
12
+
13
+
14
+ class Basemap(Base):
15
+
16
+ BASE_ENDPOINT = 'basemaps/'
17
+
18
+ def __init__(self,
19
+ api: 'GeoboxClient',
20
+ data: Optional[Dict] = {}):
21
+ """
22
+ Initialize a basemap instance.
23
+
24
+ Args:
25
+ api (GeoboxClient): The GeoboxClient instance for making requests.
26
+ data (Dict): The data of the basemap.
27
+ """
28
+ super().__init__(api, data=data)
29
+ self.endpoint = f"{self.BASE_ENDPOINT}{self.data.get('name')}/"
30
+
31
+
32
+ @classmethod
33
+ def get_basemaps(cls, api: 'GeoboxClient') -> List['Basemap']:
34
+ """
35
+ Get a list of basemaps
36
+
37
+ Args:
38
+ api (GeoboxClient): The GeoboxClient instance for making requests.
39
+
40
+ Returns:
41
+ List[BaseMap]: list of basemaps.
42
+
43
+ Example:
44
+ >>> from geobox import GeoboxClient
45
+ >>> from geobox.basemap import Basemap
46
+ >>> client = GeoboxClient()
47
+ >>> basemaps = Basemap.get_basemaps(client)
48
+ or
49
+ >>> basemaps = client.get_basemaps()
50
+ """
51
+ response = api.get(cls.BASE_ENDPOINT)
52
+ if not response:
53
+ return []
54
+
55
+ items = []
56
+ for item in response:
57
+ response[item]['name'] = item
58
+ items.append(response[item])
59
+
60
+ return [cls(api, item) for item in items]
61
+
62
+
63
+ @classmethod
64
+ def get_basemap(cls, api: 'GeoboxClient', name: str) -> 'Basemap':
65
+ """
66
+ Get a basemap object
67
+
68
+ Args:
69
+ api (GeoboxClient): The GeoboxClient instance for making requests.
70
+ name: the basemap name
71
+
72
+ Returns:
73
+ Basemap: the basemap object
74
+
75
+ Raises:
76
+ NotFoundError: if the base,ap with the specified name not found
77
+
78
+ Example:
79
+ >>> from geobox import GeoboxClient
80
+ >>> from geobox.basemap import Basemap
81
+ >>> client = GeoboxClient()
82
+ >>> basemap = Basemap.get_basemap(client, name='test')
83
+ or
84
+ >>> basemap = client.get_basemap(name='test')
85
+ """
86
+ basemap = [basemap for basemap in cls.get_basemaps(api) if basemap.name == name]
87
+ if not basemap:
88
+ raise NotFoundError(f'Basemap with name "{name}" not found.')
89
+
90
+ return basemap[0]
91
+
92
+
93
+ @property
94
+ def thumbnail(self) -> str:
95
+ """
96
+ Get the thumbnail url of the basemap
97
+
98
+ Returns:
99
+ str: the thumbnail url
100
+ """
101
+ return super()._thumbnail()
102
+
103
+
104
+ @property
105
+ def wmts(self) -> str:
106
+ """
107
+ Get the wmts url of the basemap
108
+
109
+ Returns:
110
+ str: the wmts url
111
+ """
112
+ endpoint = urljoin(self.api.base_url, f'{self.endpoint}wmts/')
113
+
114
+ if not self.api.access_token and self.api.apikey:
115
+ endpoint = f"{endpoint}?apikey={self.api.apikey}"
116
+
117
+ return endpoint
118
+
119
+
120
+ @property
121
+ def server_url(self) -> str:
122
+ """
123
+ Get the server url of the basemap
124
+
125
+ Returns:
126
+ str: the server url
127
+ """
128
+ endpoint = f'{self.api.base_url}{self.BASE_ENDPOINT}server_url'
129
+ return self.api.get(endpoint)
130
+
131
+
132
+ @property
133
+ def proxy_url(self) -> str:
134
+ """
135
+ Get the proxy url of the basemap
136
+
137
+ Returns:
138
+ str: the proxy url
139
+ """
140
+ endpoint = f'{self.api.base_url}{self.BASE_ENDPOINT}proxy_url'
141
+ return self.api.get(endpoint)
142
+
143
+
144
+ @classmethod
145
+ def proxy_basemap(cls, api: 'GeoboxClient', url: str) -> None:
146
+ """
147
+ Proxy the basemap
148
+
149
+ Args:
150
+ api (GeoboxClient): The GeoboxClient instance for making requests.
151
+ url (str): the proxy server url.
152
+
153
+ Returns:
154
+ None
155
+
156
+ Example:
157
+ >>> from geobox import GeoboxClient
158
+ >>> from geobox.basemap import Basemap
159
+ >>> client = GeoboxClient()
160
+ >>> Basemap.proxy_basemap(client, url='proxy_server_url')
161
+ or
162
+ >>> client.proxy_basemap(url='proxy_server_url')
163
+ """
164
+ param = clean_data({
165
+ 'url': url
166
+ })
167
+ query_string = urlencode(param)
168
+ endpoint = urljoin(cls.BASE_ENDPOINT, f"?{query_string}")
169
+ api.get(endpoint)
170
+
171
+
172
+ def to_async(self, async_client: 'AsyncGeoboxClient') -> 'AsyncBasemap':
173
+ """
174
+ Switch to async version of the basemap instance to have access to the async methods
175
+
176
+ Args:
177
+ async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
178
+
179
+ Returns:
180
+ AsyncBasemap: the async instance of the basemap.
181
+
182
+ Example:
183
+ >>> from geobox import Geoboxclient
184
+ >>> from geobox.aio import AsyncGeoboxClient
185
+ >>> from geobox.basemap import Basemap
186
+ >>> client = GeoboxClient()
187
+ >>> basemap = Basemap.get_basemap(client, name='test')
188
+ or
189
+ >>> basemap = client.get_basemap(name='test')
190
+ >>> async with AsyncGeoboxClient() as async_client:
191
+ >>> async_basemap = basemap.to_async(async_client)
192
+ """
193
+ from .aio.basemap import AsyncBasemap
194
+
195
195
  return AsyncBasemap(api=async_client, data=self.data)