geobox 2.2.3__tar.gz → 2.2.5__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.3 → geobox-2.2.5}/PKG-INFO +1 -1
  2. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/query.py +1 -1
  3. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/vectorlayer.py +12 -3
  4. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/view.py +7 -3
  5. {geobox-2.2.3 → geobox-2.2.5}/geobox/enums.py +4 -4
  6. {geobox-2.2.3 → geobox-2.2.5}/geobox/query.py +1 -1
  7. {geobox-2.2.3 → geobox-2.2.5}/geobox/vectorlayer.py +22 -13
  8. {geobox-2.2.3 → geobox-2.2.5}/geobox/view.py +15 -11
  9. {geobox-2.2.3 → geobox-2.2.5}/geobox.egg-info/PKG-INFO +1 -1
  10. {geobox-2.2.3 → geobox-2.2.5}/pyproject.toml +1 -1
  11. {geobox-2.2.3 → geobox-2.2.5}/tests/test_vectorlayer.py +7 -1
  12. {geobox-2.2.3 → geobox-2.2.5}/tests/test_view.py +7 -1
  13. {geobox-2.2.3 → geobox-2.2.5}/LICENSE +0 -0
  14. {geobox-2.2.3 → geobox-2.2.5}/README.md +0 -0
  15. {geobox-2.2.3 → geobox-2.2.5}/geobox/__init__.py +0 -0
  16. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/__init__.py +0 -0
  17. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/api.py +0 -0
  18. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/apikey.py +0 -0
  19. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/attachment.py +0 -0
  20. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/base.py +0 -0
  21. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/basemap.py +0 -0
  22. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/dashboard.py +0 -0
  23. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/feature.py +0 -0
  24. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/field.py +0 -0
  25. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/file.py +0 -0
  26. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/layout.py +0 -0
  27. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/log.py +0 -0
  28. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/map.py +0 -0
  29. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/model3d.py +0 -0
  30. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/mosaic.py +0 -0
  31. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/plan.py +0 -0
  32. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/raster.py +0 -0
  33. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/raster_analysis.py +0 -0
  34. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/route.py +0 -0
  35. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/scene.py +0 -0
  36. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/settings.py +0 -0
  37. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/task.py +0 -0
  38. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/tile3d.py +0 -0
  39. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/tileset.py +0 -0
  40. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/usage.py +0 -0
  41. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/user.py +0 -0
  42. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/vector_tool.py +0 -0
  43. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/version.py +0 -0
  44. {geobox-2.2.3 → geobox-2.2.5}/geobox/aio/workflow.py +0 -0
  45. {geobox-2.2.3 → geobox-2.2.5}/geobox/api.py +0 -0
  46. {geobox-2.2.3 → geobox-2.2.5}/geobox/apikey.py +0 -0
  47. {geobox-2.2.3 → geobox-2.2.5}/geobox/attachment.py +0 -0
  48. {geobox-2.2.3 → geobox-2.2.5}/geobox/base.py +0 -0
  49. {geobox-2.2.3 → geobox-2.2.5}/geobox/basemap.py +0 -0
  50. {geobox-2.2.3 → geobox-2.2.5}/geobox/dashboard.py +0 -0
  51. {geobox-2.2.3 → geobox-2.2.5}/geobox/exception.py +0 -0
  52. {geobox-2.2.3 → geobox-2.2.5}/geobox/feature.py +0 -0
  53. {geobox-2.2.3 → geobox-2.2.5}/geobox/field.py +0 -0
  54. {geobox-2.2.3 → geobox-2.2.5}/geobox/file.py +0 -0
  55. {geobox-2.2.3 → geobox-2.2.5}/geobox/layout.py +0 -0
  56. {geobox-2.2.3 → geobox-2.2.5}/geobox/log.py +0 -0
  57. {geobox-2.2.3 → geobox-2.2.5}/geobox/map.py +0 -0
  58. {geobox-2.2.3 → geobox-2.2.5}/geobox/model3d.py +0 -0
  59. {geobox-2.2.3 → geobox-2.2.5}/geobox/mosaic.py +0 -0
  60. {geobox-2.2.3 → geobox-2.2.5}/geobox/plan.py +0 -0
  61. {geobox-2.2.3 → geobox-2.2.5}/geobox/raster.py +0 -0
  62. {geobox-2.2.3 → geobox-2.2.5}/geobox/raster_analysis.py +0 -0
  63. {geobox-2.2.3 → geobox-2.2.5}/geobox/route.py +0 -0
  64. {geobox-2.2.3 → geobox-2.2.5}/geobox/scene.py +0 -0
  65. {geobox-2.2.3 → geobox-2.2.5}/geobox/settings.py +0 -0
  66. {geobox-2.2.3 → geobox-2.2.5}/geobox/task.py +0 -0
  67. {geobox-2.2.3 → geobox-2.2.5}/geobox/tile3d.py +0 -0
  68. {geobox-2.2.3 → geobox-2.2.5}/geobox/tileset.py +0 -0
  69. {geobox-2.2.3 → geobox-2.2.5}/geobox/usage.py +0 -0
  70. {geobox-2.2.3 → geobox-2.2.5}/geobox/user.py +0 -0
  71. {geobox-2.2.3 → geobox-2.2.5}/geobox/utils.py +0 -0
  72. {geobox-2.2.3 → geobox-2.2.5}/geobox/vector_tool.py +0 -0
  73. {geobox-2.2.3 → geobox-2.2.5}/geobox/version.py +0 -0
  74. {geobox-2.2.3 → geobox-2.2.5}/geobox/workflow.py +0 -0
  75. {geobox-2.2.3 → geobox-2.2.5}/geobox.egg-info/SOURCES.txt +0 -0
  76. {geobox-2.2.3 → geobox-2.2.5}/geobox.egg-info/dependency_links.txt +0 -0
  77. {geobox-2.2.3 → geobox-2.2.5}/geobox.egg-info/requires.txt +0 -0
  78. {geobox-2.2.3 → geobox-2.2.5}/geobox.egg-info/top_level.txt +0 -0
  79. {geobox-2.2.3 → geobox-2.2.5}/setup.cfg +0 -0
  80. {geobox-2.2.3 → geobox-2.2.5}/tests/test_api.py +0 -0
  81. {geobox-2.2.3 → geobox-2.2.5}/tests/test_apikey.py +0 -0
  82. {geobox-2.2.3 → geobox-2.2.5}/tests/test_attachment.py +0 -0
  83. {geobox-2.2.3 → geobox-2.2.5}/tests/test_basemap.py +0 -0
  84. {geobox-2.2.3 → geobox-2.2.5}/tests/test_dashboard.py +0 -0
  85. {geobox-2.2.3 → geobox-2.2.5}/tests/test_feature.py +0 -0
  86. {geobox-2.2.3 → geobox-2.2.5}/tests/test_field.py +0 -0
  87. {geobox-2.2.3 → geobox-2.2.5}/tests/test_file.py +0 -0
  88. {geobox-2.2.3 → geobox-2.2.5}/tests/test_layout.py +0 -0
  89. {geobox-2.2.3 → geobox-2.2.5}/tests/test_log.py +0 -0
  90. {geobox-2.2.3 → geobox-2.2.5}/tests/test_map.py +0 -0
  91. {geobox-2.2.3 → geobox-2.2.5}/tests/test_model3d.py +0 -0
  92. {geobox-2.2.3 → geobox-2.2.5}/tests/test_mosaic.py +0 -0
  93. {geobox-2.2.3 → geobox-2.2.5}/tests/test_plan.py +0 -0
  94. {geobox-2.2.3 → geobox-2.2.5}/tests/test_query.py +0 -0
  95. {geobox-2.2.3 → geobox-2.2.5}/tests/test_raster.py +0 -0
  96. {geobox-2.2.3 → geobox-2.2.5}/tests/test_raster_analysis.py +0 -0
  97. {geobox-2.2.3 → geobox-2.2.5}/tests/test_route.py +0 -0
  98. {geobox-2.2.3 → geobox-2.2.5}/tests/test_scene.py +0 -0
  99. {geobox-2.2.3 → geobox-2.2.5}/tests/test_settings.py +0 -0
  100. {geobox-2.2.3 → geobox-2.2.5}/tests/test_task.py +0 -0
  101. {geobox-2.2.3 → geobox-2.2.5}/tests/test_tile3d.py +0 -0
  102. {geobox-2.2.3 → geobox-2.2.5}/tests/test_tileset.py +0 -0
  103. {geobox-2.2.3 → geobox-2.2.5}/tests/test_usage.py +0 -0
  104. {geobox-2.2.3 → geobox-2.2.5}/tests/test_user.py +0 -0
  105. {geobox-2.2.3 → geobox-2.2.5}/tests/test_vector_tool.py +0 -0
  106. {geobox-2.2.3 → geobox-2.2.5}/tests/test_version.py +0 -0
  107. {geobox-2.2.3 → geobox-2.2.5}/tests/test_workflow.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geobox
3
- Version: 2.2.3
3
+ Version: 2.2.5
4
4
  Summary: SDK for Geobox's APIs
5
5
  Author-email: Hamid Heydari <heydari.h62@gmail.com>
6
6
  License: MIT
@@ -483,7 +483,7 @@ class AsyncQuery(AsyncBase):
483
483
  "sql": kwargs.get('sql'),
484
484
  "params": kwargs.get('params')
485
485
  }
486
- await super()._update(self.endpoint, data)
486
+ return await super()._update(self.endpoint, data)
487
487
 
488
488
 
489
489
  async def save(self) -> None:
@@ -658,10 +658,14 @@ class AsyncVectorLayer(AsyncBase):
658
658
  return response
659
659
 
660
660
 
661
- async def get_features(self, **kwargs) -> Union[List['AsyncFeature'], int]:
661
+ async def get_features(self, geojson: bool = False, **kwargs) -> Union[List['AsyncFeature'], Dict, int]:
662
662
  """
663
663
  [async] Get features from the layer with optional filtering and pagination.
664
664
 
665
+ Args:
666
+ geojson (bool, optional): If True, returns the raw API response (GeoJSON dict).
667
+ If False, returns a list of Feature objects. default: False.
668
+
665
669
  Keyword Args:
666
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.
667
671
  skip (int): Number of features to skip. default is 0.
@@ -681,7 +685,7 @@ class AsyncVectorLayer(AsyncBase):
681
685
  bbox_srid (int): srid (epsg code) of bbox. e.g. 4326. default is 3857.
682
686
 
683
687
  Returns:
684
- List[Feature] | int: A list of Feature instances or the features count if return_count is True.
688
+ List[Feature] | Dict | int: A list of Feature instances or the geojson api response if geojson=True or the features count if return_count is True.
685
689
 
686
690
  Example:
687
691
  >>> from geobox.aio import AsyncGeoboxClient
@@ -718,8 +722,13 @@ class AsyncVectorLayer(AsyncBase):
718
722
  'bbox_srid': kwargs.get('bbox_srid', 3857)
719
723
  }
720
724
 
725
+ endpoint = f'{self.endpoint}features/'
726
+
727
+ if geojson:
728
+ return await self.api.get(endpoint)
729
+
721
730
  return await super()._get_list(api=self.api,
722
- endpoint=f'{self.endpoint}features/',
731
+ endpoint=endpoint,
723
732
  params=params,
724
733
  factory_func=lambda api, item, srid: AsyncFeature(self, srid, item),
725
734
  geojson=True)
@@ -451,10 +451,14 @@ class AsyncVectorLayerView(AsyncVectorLayer):
451
451
  return await super().calculate_field(target_field, expression, q, bbox, bbox_srid, feature_ids, run_async, user_id)
452
452
 
453
453
 
454
- async def get_features(self, **kwargs) -> Union[List['AsyncFeature'], int]:
454
+ async def get_features(self, geojson: bool = False, **kwargs) -> Union[List['AsyncFeature'], Dict, int]:
455
455
  """
456
456
  [async] Get features from the layer with optional filtering and pagination.
457
457
 
458
+ Args:
459
+ geojson (bool, optional): If True, returns the raw API response (GeoJSON dict).
460
+ If False, returns a list of Feature objects. default: False.
461
+
458
462
  Keyword Args:
459
463
  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.
460
464
  skip (int): Number of features to skip. default is 0.
@@ -474,7 +478,7 @@ class AsyncVectorLayerView(AsyncVectorLayer):
474
478
  bbox_srid (int): srid (epsg code) of bbox. e.g. 4326. default is 3857.
475
479
 
476
480
  Returns:
477
- List[AsyncFeature] | int: A list of Feature instances or the features count if return_count is True.
481
+ List[Feature] | Dict | int: A list of Feature instances or the geojson api response if geojson=True or the features count if return_count is True.
478
482
 
479
483
 
480
484
  Example:
@@ -491,7 +495,7 @@ class AsyncVectorLayerView(AsyncVectorLayer):
491
495
  ... out_srid=4326,
492
496
  ... bbox_srid=4326)
493
497
  """
494
- return await super().get_features(**kwargs)
498
+ return await super().get_features(geojson=geojson, **kwargs)
495
499
 
496
500
 
497
501
  async def get_feature(self, feature_id: int, out_srid: int = AsyncFeature.BASE_SRID) -> 'AsyncFeature':
@@ -3,16 +3,16 @@ from enum import Enum
3
3
  # File Enums
4
4
  class InputGeomType(Enum):
5
5
  POINT = 'POINT'
6
- LINE = 'LINE'
6
+ LINESTRING = 'LINESTRING'
7
7
  POLYGON = 'POLYGON'
8
8
  MULTIPOINT = 'MULTIPOINT'
9
- MULTILINE = 'MULTILINE'
9
+ MULTILINESTRING = 'MULTILINESTRING'
10
10
  MULTIPOLYGON = 'MULTIPOLYGON'
11
11
  POINT_Z = 'POINTZ'
12
- LINE_Z = 'LINEZ'
12
+ LINESTRING_Z = 'LINESTRINGZ'
13
13
  POLYGON_Z = 'POLYGONZ'
14
14
  MULTIPOINT_Z = 'MULTIPOINTZ'
15
- MULTILINE_Z = 'MULTILINEZ'
15
+ MULTILINESTRING_Z = 'MULTILINESTRINGZ'
16
16
  MULTIPOLYGON_Z = 'MULTIPOLYGONZ'
17
17
 
18
18
  class PublishFileType(Enum):
@@ -482,7 +482,7 @@ class Query(Base):
482
482
  "sql": kwargs.get('sql'),
483
483
  "params": kwargs.get('params')
484
484
  }
485
- super()._update(self.endpoint, data)
485
+ return super()._update(self.endpoint, data)
486
486
 
487
487
 
488
488
  def save(self) -> None:
@@ -660,10 +660,14 @@ class VectorLayer(Base):
660
660
  return response
661
661
 
662
662
 
663
- def get_features(self, **kwargs) -> Union[List['Feature'], int]:
663
+ def get_features(self, geojson: bool = False, **kwargs) -> Union[List['Feature'], Dict, int]:
664
664
  """
665
665
  Get features from the layer with optional filtering and pagination.
666
666
 
667
+ Args:
668
+ geojson (bool, optional): If True, returns the raw API response (GeoJSON dict).
669
+ If False, returns a list of Feature objects. default: False.
670
+
667
671
  Keyword Args:
668
672
  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.
669
673
  skip (int): Number of features to skip. default is 0.
@@ -683,7 +687,7 @@ class VectorLayer(Base):
683
687
  bbox_srid (int): srid (epsg code) of bbox. e.g. 4326. default is 3857.
684
688
 
685
689
  Returns:
686
- List[Feature] | int: A list of Feature instances or the features count if return_count is True.
690
+ List[Feature] | Dict | int: A list of Feature instances or the geojson api response if geojson=True or the features count if return_count is True.
687
691
 
688
692
  Example:
689
693
  >>> from geobox import GeoboxClient
@@ -691,13 +695,13 @@ class VectorLayer(Base):
691
695
  >>> client = GeoboxClient()
692
696
  >>> layer = VectorLayer.get_vector(api=client, uuid="12345678-1234-5678-1234-567812345678")
693
697
  >>> features = layer.get_features(quant_factor=1000000,
694
- ... skip=0,
695
- ... limit=100,
696
- ... skip_geometry=False,
697
- ... return_count=False,
698
- ... select_fields="fclass, osm_id",
699
- ... out_srid=3857,
700
- ... bbox_srid=3857)
698
+ ... skip=0,
699
+ ... limit=100,
700
+ ... skip_geometry=False,
701
+ ... return_count=False,
702
+ ... select_fields="fclass, osm_id",
703
+ ... out_srid=3857,
704
+ ... bbox_srid=3857)
701
705
  """
702
706
  params = {
703
707
  'f': 'json',
@@ -719,11 +723,16 @@ class VectorLayer(Base):
719
723
  'bbox_srid': kwargs.get('bbox_srid', 3857)
720
724
  }
721
725
 
726
+ endpoint = f'{self.endpoint}features/'
727
+
728
+ if geojson:
729
+ return self.api.get(endpoint)
730
+
722
731
  return super()._get_list(api=self.api,
723
- endpoint=f'{self.endpoint}features/',
724
- params=params,
725
- factory_func=lambda api, item, srid: Feature(self, srid, item),
726
- geojson=True)
732
+ endpoint=endpoint,
733
+ params=params,
734
+ factory_func=lambda api, item, srid: Feature(self, srid, item),
735
+ geojson=True)
727
736
 
728
737
 
729
738
  def get_feature(self, feature_id: int, out_srid: int = Feature.BASE_SRID) -> 'Feature':
@@ -445,10 +445,14 @@ class VectorLayerView(VectorLayer):
445
445
  return super().calculate_field(target_field, expression, q, bbox, bbox_srid, feature_ids, run_async, user_id)
446
446
 
447
447
 
448
- def get_features(self, **kwargs) -> Union[List['Feature'], int]:
448
+ def get_features(self, geojson: bool = False, **kwargs) -> Union[List['Feature'], Dict, int]:
449
449
  """
450
450
  Get features from the layer with optional filtering and pagination.
451
451
 
452
+ Args:
453
+ geojson (bool, optional): If True, returns the raw API response (GeoJSON dict).
454
+ If False, returns a list of Feature objects. default: False.
455
+
452
456
  Keyword Args:
453
457
  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.
454
458
  skip (int): Number of features to skip. default is 0.
@@ -468,7 +472,7 @@ class VectorLayerView(VectorLayer):
468
472
  bbox_srid (int): srid (epsg code) of bbox. e.g. 4326. default is 3857.
469
473
 
470
474
  Returns:
471
- List[Feature] | int: A list of Feature instances or the features count if return_count is True.
475
+ List[Feature] | Dict | int: A list of Feature instances or the geojson api response if geojson=True or the features count if return_count is True.
472
476
 
473
477
 
474
478
  Example:
@@ -477,15 +481,15 @@ class VectorLayerView(VectorLayer):
477
481
  >>> client = GeoboxClient()
478
482
  >>> layer = VectorLayerView(api=client, name="my_layer", layer_type=LayerType.Point)
479
483
  >>> features = layer.get_features(quant_factor=1000000,
480
- ... skip=0,
481
- ... limit=100,
482
- ... skip_geometry=False,
483
- ... return_count=False,
484
- ... select_fields="fclass, osm_id",
485
- ... out_srid=4326,
486
- ... bbox_srid=4326)
487
- """
488
- return super().get_features(**kwargs)
484
+ ... skip=0,
485
+ ... limit=100,
486
+ ... skip_geometry=False,
487
+ ... return_count=False,
488
+ ... select_fields="fclass, osm_id",
489
+ ... out_srid=4326,
490
+ ... bbox_srid=4326)
491
+ """
492
+ return super().get_features(geojson=geojson, **kwargs)
489
493
 
490
494
 
491
495
  def get_feature(self, feature_id: int, out_srid: int = Feature.BASE_SRID) -> 'Feature':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geobox
3
- Version: 2.2.3
3
+ Version: 2.2.5
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.3"
7
+ version = "2.2.5"
8
8
  description = "SDK for Geobox's APIs"
9
9
  authors = [
10
10
  {name = "Hamid Heydari", email = "heydari.h62@gmail.com"}
@@ -381,7 +381,8 @@ def test_get_features(api, mock_vector_data, layer_type, mock_feature_data):
381
381
  """Test getting a specific feature."""
382
382
  layer = VectorLayer(api, uuid=mock_vector_data['uuid'], data=mock_vector_data, layer_type=layer_type)
383
383
  layer.create_feature(geojson=mock_feature_data[FeatureType.Polygon.value])
384
- api.get.return_value = {
384
+ geojson = {
385
+ 'type': 'FeatureCollection',
385
386
  'features': [mock_feature_data[FeatureType.Polygon.value]],
386
387
  'crs': {
387
388
  'properties': {
@@ -389,6 +390,7 @@ def test_get_features(api, mock_vector_data, layer_type, mock_feature_data):
389
390
  }
390
391
  }
391
392
  }
393
+ api.get.return_value = geojson
392
394
  params = clean_data({
393
395
  'f': 'json',
394
396
  'quant_factor': 1000000,
@@ -413,6 +415,10 @@ def test_get_features(api, mock_vector_data, layer_type, mock_feature_data):
413
415
  assert features[0].layer == layer
414
416
  assert features[0].data == mock_feature_data[FeatureType.Polygon.value]
415
417
  assert features[0].endpoint == f'vectorLayers/{mock_vector_data["uuid"]}/features/{mock_feature_data[FeatureType.Polygon.value]["id"]}/'
418
+ # get geojson
419
+ result = layer.get_features(geojson=True)
420
+ assert type(result) == dict
421
+ assert result == geojson
416
422
  # return count
417
423
  api.get.return_value = {'count': 1}
418
424
  count = layer.get_features(return_count=True)
@@ -357,7 +357,8 @@ def test_get_features(api, mock_view_data, layer_type, mock_feature_data):
357
357
  data=mock_view_data
358
358
  )
359
359
  view.create_feature(geojson=mock_feature_data[FeatureType.Polygon.value])
360
- api.get.return_value = {
360
+ geojson = {
361
+ 'type': 'FeatureCollection',
361
362
  'features': [mock_feature_data[FeatureType.Polygon.value]],
362
363
  'crs': {
363
364
  'properties': {
@@ -365,6 +366,7 @@ def test_get_features(api, mock_view_data, layer_type, mock_feature_data):
365
366
  }
366
367
  }
367
368
  }
369
+ api.get.return_value = geojson
368
370
  params = clean_data({
369
371
  'f': 'json',
370
372
  'quant_factor': 1000000,
@@ -389,6 +391,10 @@ def test_get_features(api, mock_view_data, layer_type, mock_feature_data):
389
391
  assert features[0].layer == view
390
392
  assert features[0].data == mock_feature_data[FeatureType.Polygon.value]
391
393
  assert features[0].endpoint == f'vectorLayerViews/{mock_view_data["uuid"]}/features/{mock_feature_data[FeatureType.Polygon.value]["id"]}/'
394
+ # get geojson
395
+ result = view.get_features(geojson=True)
396
+ assert type(result) == dict
397
+ assert result == geojson
392
398
  # return count
393
399
  api.get.return_value = {'count': 1}
394
400
  count = view.get_features(return_count=True)
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