geobox 2.2.0__tar.gz → 2.2.1__tar.gz

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 (107) hide show
  1. {geobox-2.2.0 → geobox-2.2.1}/PKG-INFO +1 -1
  2. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/feature.py +13 -3
  3. {geobox-2.2.0 → geobox-2.2.1}/geobox/feature.py +26 -5
  4. {geobox-2.2.0 → geobox-2.2.1}/geobox.egg-info/PKG-INFO +1 -1
  5. {geobox-2.2.0 → geobox-2.2.1}/pyproject.toml +1 -1
  6. {geobox-2.2.0 → geobox-2.2.1}/LICENSE +0 -0
  7. {geobox-2.2.0 → geobox-2.2.1}/README.md +0 -0
  8. {geobox-2.2.0 → geobox-2.2.1}/geobox/__init__.py +0 -0
  9. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/__init__.py +0 -0
  10. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/api.py +0 -0
  11. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/apikey.py +0 -0
  12. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/attachment.py +0 -0
  13. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/base.py +0 -0
  14. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/basemap.py +0 -0
  15. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/dashboard.py +0 -0
  16. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/field.py +0 -0
  17. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/file.py +0 -0
  18. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/layout.py +0 -0
  19. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/log.py +0 -0
  20. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/map.py +0 -0
  21. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/model3d.py +0 -0
  22. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/mosaic.py +0 -0
  23. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/plan.py +0 -0
  24. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/query.py +0 -0
  25. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/raster.py +0 -0
  26. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/raster_analysis.py +0 -0
  27. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/route.py +0 -0
  28. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/scene.py +0 -0
  29. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/settings.py +0 -0
  30. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/task.py +0 -0
  31. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/tile3d.py +0 -0
  32. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/tileset.py +0 -0
  33. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/usage.py +0 -0
  34. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/user.py +0 -0
  35. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/vector_tool.py +0 -0
  36. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/vectorlayer.py +0 -0
  37. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/version.py +0 -0
  38. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/view.py +0 -0
  39. {geobox-2.2.0 → geobox-2.2.1}/geobox/aio/workflow.py +0 -0
  40. {geobox-2.2.0 → geobox-2.2.1}/geobox/api.py +0 -0
  41. {geobox-2.2.0 → geobox-2.2.1}/geobox/apikey.py +0 -0
  42. {geobox-2.2.0 → geobox-2.2.1}/geobox/attachment.py +0 -0
  43. {geobox-2.2.0 → geobox-2.2.1}/geobox/base.py +0 -0
  44. {geobox-2.2.0 → geobox-2.2.1}/geobox/basemap.py +0 -0
  45. {geobox-2.2.0 → geobox-2.2.1}/geobox/dashboard.py +0 -0
  46. {geobox-2.2.0 → geobox-2.2.1}/geobox/enums.py +0 -0
  47. {geobox-2.2.0 → geobox-2.2.1}/geobox/exception.py +0 -0
  48. {geobox-2.2.0 → geobox-2.2.1}/geobox/field.py +0 -0
  49. {geobox-2.2.0 → geobox-2.2.1}/geobox/file.py +0 -0
  50. {geobox-2.2.0 → geobox-2.2.1}/geobox/layout.py +0 -0
  51. {geobox-2.2.0 → geobox-2.2.1}/geobox/log.py +0 -0
  52. {geobox-2.2.0 → geobox-2.2.1}/geobox/map.py +0 -0
  53. {geobox-2.2.0 → geobox-2.2.1}/geobox/model3d.py +0 -0
  54. {geobox-2.2.0 → geobox-2.2.1}/geobox/mosaic.py +0 -0
  55. {geobox-2.2.0 → geobox-2.2.1}/geobox/plan.py +0 -0
  56. {geobox-2.2.0 → geobox-2.2.1}/geobox/query.py +0 -0
  57. {geobox-2.2.0 → geobox-2.2.1}/geobox/raster.py +0 -0
  58. {geobox-2.2.0 → geobox-2.2.1}/geobox/raster_analysis.py +0 -0
  59. {geobox-2.2.0 → geobox-2.2.1}/geobox/route.py +0 -0
  60. {geobox-2.2.0 → geobox-2.2.1}/geobox/scene.py +0 -0
  61. {geobox-2.2.0 → geobox-2.2.1}/geobox/settings.py +0 -0
  62. {geobox-2.2.0 → geobox-2.2.1}/geobox/task.py +0 -0
  63. {geobox-2.2.0 → geobox-2.2.1}/geobox/tile3d.py +0 -0
  64. {geobox-2.2.0 → geobox-2.2.1}/geobox/tileset.py +0 -0
  65. {geobox-2.2.0 → geobox-2.2.1}/geobox/usage.py +0 -0
  66. {geobox-2.2.0 → geobox-2.2.1}/geobox/user.py +0 -0
  67. {geobox-2.2.0 → geobox-2.2.1}/geobox/utils.py +0 -0
  68. {geobox-2.2.0 → geobox-2.2.1}/geobox/vector_tool.py +0 -0
  69. {geobox-2.2.0 → geobox-2.2.1}/geobox/vectorlayer.py +0 -0
  70. {geobox-2.2.0 → geobox-2.2.1}/geobox/version.py +0 -0
  71. {geobox-2.2.0 → geobox-2.2.1}/geobox/view.py +0 -0
  72. {geobox-2.2.0 → geobox-2.2.1}/geobox/workflow.py +0 -0
  73. {geobox-2.2.0 → geobox-2.2.1}/geobox.egg-info/SOURCES.txt +0 -0
  74. {geobox-2.2.0 → geobox-2.2.1}/geobox.egg-info/dependency_links.txt +0 -0
  75. {geobox-2.2.0 → geobox-2.2.1}/geobox.egg-info/requires.txt +0 -0
  76. {geobox-2.2.0 → geobox-2.2.1}/geobox.egg-info/top_level.txt +0 -0
  77. {geobox-2.2.0 → geobox-2.2.1}/setup.cfg +0 -0
  78. {geobox-2.2.0 → geobox-2.2.1}/tests/test_api.py +0 -0
  79. {geobox-2.2.0 → geobox-2.2.1}/tests/test_apikey.py +0 -0
  80. {geobox-2.2.0 → geobox-2.2.1}/tests/test_attachment.py +0 -0
  81. {geobox-2.2.0 → geobox-2.2.1}/tests/test_basemap.py +0 -0
  82. {geobox-2.2.0 → geobox-2.2.1}/tests/test_dashboard.py +0 -0
  83. {geobox-2.2.0 → geobox-2.2.1}/tests/test_feature.py +0 -0
  84. {geobox-2.2.0 → geobox-2.2.1}/tests/test_field.py +0 -0
  85. {geobox-2.2.0 → geobox-2.2.1}/tests/test_file.py +0 -0
  86. {geobox-2.2.0 → geobox-2.2.1}/tests/test_layout.py +0 -0
  87. {geobox-2.2.0 → geobox-2.2.1}/tests/test_log.py +0 -0
  88. {geobox-2.2.0 → geobox-2.2.1}/tests/test_map.py +0 -0
  89. {geobox-2.2.0 → geobox-2.2.1}/tests/test_model3d.py +0 -0
  90. {geobox-2.2.0 → geobox-2.2.1}/tests/test_mosaic.py +0 -0
  91. {geobox-2.2.0 → geobox-2.2.1}/tests/test_plan.py +0 -0
  92. {geobox-2.2.0 → geobox-2.2.1}/tests/test_query.py +0 -0
  93. {geobox-2.2.0 → geobox-2.2.1}/tests/test_raster.py +0 -0
  94. {geobox-2.2.0 → geobox-2.2.1}/tests/test_raster_analysis.py +0 -0
  95. {geobox-2.2.0 → geobox-2.2.1}/tests/test_route.py +0 -0
  96. {geobox-2.2.0 → geobox-2.2.1}/tests/test_scene.py +0 -0
  97. {geobox-2.2.0 → geobox-2.2.1}/tests/test_settings.py +0 -0
  98. {geobox-2.2.0 → geobox-2.2.1}/tests/test_task.py +0 -0
  99. {geobox-2.2.0 → geobox-2.2.1}/tests/test_tile3d.py +0 -0
  100. {geobox-2.2.0 → geobox-2.2.1}/tests/test_tileset.py +0 -0
  101. {geobox-2.2.0 → geobox-2.2.1}/tests/test_usage.py +0 -0
  102. {geobox-2.2.0 → geobox-2.2.1}/tests/test_user.py +0 -0
  103. {geobox-2.2.0 → geobox-2.2.1}/tests/test_vector_tool.py +0 -0
  104. {geobox-2.2.0 → geobox-2.2.1}/tests/test_vectorlayer.py +0 -0
  105. {geobox-2.2.0 → geobox-2.2.1}/tests/test_version.py +0 -0
  106. {geobox-2.2.0 → geobox-2.2.1}/tests/test_view.py +0 -0
  107. {geobox-2.2.0 → geobox-2.2.1}/tests/test_workflow.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geobox
3
- Version: 2.2.0
3
+ Version: 2.2.1
4
4
  Summary: SDK for Geobox's APIs
5
5
  Author-email: Hamid Heydari <heydari.h62@gmail.com>
6
6
  License: MIT
@@ -58,7 +58,8 @@ class AsyncFeature(AsyncBase):
58
58
  Returns:
59
59
  str: A string representation of the Feature object.
60
60
  """
61
- return f"AsyncFeature(id={self.id}, type={self.feature_type})"
61
+ feature_id = getattr(self, "id", "-1")
62
+ return f"AsyncFeature(id={feature_id}, type={self.feature_type})"
62
63
 
63
64
 
64
65
  def __getattr__(self, name: str) -> Any:
@@ -210,18 +211,27 @@ class AsyncFeature(AsyncBase):
210
211
  >>> await feature.save()
211
212
  """
212
213
  data = self.data.copy()
214
+ srid = self.srid
215
+
213
216
  try:
214
217
  if self.id:
215
218
  if self.srid != self.BASE_SRID:
216
- self.data['geometry'] = self.original_geometry
219
+ self = self.transform(self.BASE_SRID)
220
+ self.data['geometry'] = self.original_geometry
217
221
  await self.update(self.data)
218
222
  self.coordinates = data['geometry']['coordinates']
219
223
  except AttributeError:
224
+ if self.srid != self.BASE_SRID:
225
+ self = self.transform(self.BASE_SRID)
220
226
  endpoint = urljoin(self.layer.endpoint, 'features/')
221
- response = await self.layer.api.post(endpoint, data)
227
+ request_data = self.data.copy()
228
+ response = await self.layer.api.post(endpoint, request_data)
222
229
  self.endpoint = urljoin(self.layer.endpoint, f'features/{response["id"]}/')
223
230
  self.data.update(response)
224
231
 
232
+ self.data['geometry'] = data['geometry']
233
+ self._srid = srid
234
+
225
235
 
226
236
  async def delete(self) -> None:
227
237
  """
@@ -30,7 +30,17 @@ class Feature(Base):
30
30
  >>> from geobox import GeoboxClient, Feature
31
31
  >>> client = GeoboxClient()
32
32
  >>> layer = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
33
- >>> feature = Feature(layer=layer, srid=4326) # example srid set to 4326
33
+ >>> geojson = {
34
+ ... "type": "Feature",
35
+ ... "geometry": {
36
+ ... "type": "Point",
37
+ ... "coordinates": [58.4, 23.6]
38
+ ... },
39
+ ... "properties": {
40
+ ... "name": "Test feature"
41
+ ... }
42
+ ... }
43
+ >>> feature = Feature(layer=layer, data=geojson, srid=4326) # example srid set to 4326
34
44
  >>> feature.save()
35
45
  """
36
46
  super().__init__(api=layer.api)
@@ -65,8 +75,9 @@ class Feature(Base):
65
75
  Returns:
66
76
  str: A string representation of the Feature object.
67
77
  """
68
- return f"Feature(id={self.id}, type={self.feature_type})"
69
-
78
+ feature_id = getattr(self, "id", "-1")
79
+ return f"Feature(id={feature_id}, type={self.feature_type})"
80
+
70
81
 
71
82
  def __getattr__(self, name: str) -> Any:
72
83
  """
@@ -217,18 +228,28 @@ class Feature(Base):
217
228
  >>> feature.save()
218
229
  """
219
230
  data = self.data.copy()
231
+ srid = self.srid
232
+
220
233
  try:
221
234
  if self.id:
222
235
  if self.srid != self.BASE_SRID:
223
- self.data['geometry'] = self.original_geometry
236
+ self = self.transform(self.BASE_SRID)
237
+ self.data['geometry'] = self.original_geometry
224
238
  self.update(self.data)
225
239
  self.coordinates = data['geometry']['coordinates']
226
240
  except AttributeError:
241
+ if self.srid != self.BASE_SRID:
242
+ self = self.transform(self.BASE_SRID)
227
243
  endpoint = urljoin(self.layer.endpoint, 'features/')
228
- response = self.layer.api.post(endpoint, data)
244
+ request_data = self.data.copy()
245
+ response = self.layer.api.post(endpoint, request_data)
229
246
  self.endpoint = urljoin(self.layer.endpoint, f'features/{response["id"]}/')
230
247
  self.data.update(response)
231
248
 
249
+ self.data['geometry'] = data['geometry']
250
+ self._srid = srid
251
+
252
+
232
253
 
233
254
  def delete(self) -> None:
234
255
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geobox
3
- Version: 2.2.0
3
+ Version: 2.2.1
4
4
  Summary: SDK for Geobox's APIs
5
5
  Author-email: Hamid Heydari <heydari.h62@gmail.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "geobox"
7
- version = "2.2.0"
7
+ version = "2.2.1"
8
8
  description = "SDK for Geobox's APIs"
9
9
  authors = [
10
10
  {name = "Hamid Heydari", email = "heydari.h62@gmail.com"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes