earthengine-api 1.5.13rc0__py3-none-any.whl → 1.7.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.

Potentially problematic release.


This version of earthengine-api might be problematic. Click here for more details.

Files changed (102) hide show
  1. {earthengine_api-1.5.13rc0.dist-info → earthengine_api-1.7.4.dist-info}/METADATA +3 -3
  2. earthengine_api-1.7.4.dist-info/RECORD +109 -0
  3. {earthengine_api-1.5.13rc0.dist-info → earthengine_api-1.7.4.dist-info}/WHEEL +1 -1
  4. ee/__init__.py +29 -28
  5. ee/_arg_types.py +7 -6
  6. ee/_cloud_api_utils.py +95 -78
  7. ee/_helpers.py +17 -13
  8. ee/_state.py +105 -0
  9. ee/_utils.py +2 -1
  10. ee/apifunction.py +21 -19
  11. ee/apitestcase.py +33 -38
  12. ee/batch.py +87 -77
  13. ee/blob.py +10 -12
  14. ee/classifier.py +57 -59
  15. ee/cli/commands.py +178 -114
  16. ee/cli/eecli.py +1 -1
  17. ee/cli/utils.py +61 -42
  18. ee/clusterer.py +39 -41
  19. ee/collection.py +64 -54
  20. ee/computedobject.py +19 -16
  21. ee/confusionmatrix.py +9 -9
  22. ee/customfunction.py +13 -12
  23. ee/data.py +220 -322
  24. ee/daterange.py +10 -10
  25. ee/deprecation.py +21 -13
  26. ee/deserializer.py +25 -20
  27. ee/dictionary.py +11 -11
  28. ee/ee_array.py +22 -20
  29. ee/ee_date.py +23 -23
  30. ee/ee_list.py +15 -16
  31. ee/ee_number.py +11 -21
  32. ee/ee_string.py +24 -32
  33. ee/ee_types.py +4 -4
  34. ee/element.py +15 -15
  35. ee/encodable.py +7 -4
  36. ee/errormargin.py +4 -4
  37. ee/feature.py +68 -71
  38. ee/featurecollection.py +41 -40
  39. ee/filter.py +90 -92
  40. ee/function.py +8 -8
  41. ee/geometry.py +95 -93
  42. ee/image.py +238 -236
  43. ee/image_converter.py +4 -4
  44. ee/imagecollection.py +30 -27
  45. ee/join.py +13 -15
  46. ee/kernel.py +55 -57
  47. ee/mapclient.py +9 -9
  48. ee/model.py +29 -31
  49. ee/oauth.py +76 -63
  50. ee/pixeltype.py +6 -6
  51. ee/projection.py +5 -4
  52. ee/reducer.py +41 -41
  53. ee/serializer.py +14 -14
  54. ee/table_converter.py +7 -6
  55. ee/terrain.py +7 -9
  56. ee/tests/_cloud_api_utils_test.py +21 -6
  57. ee/tests/_helpers_test.py +57 -4
  58. ee/tests/_state_test.py +49 -0
  59. ee/tests/algorithms.json +85 -2
  60. ee/tests/apifunction_test.py +5 -5
  61. ee/tests/batch_test.py +135 -57
  62. ee/tests/blob_test.py +5 -5
  63. ee/tests/classifier_test.py +3 -3
  64. ee/tests/clusterer_test.py +3 -3
  65. ee/tests/collection_test.py +48 -13
  66. ee/tests/confusionmatrix_test.py +3 -3
  67. ee/tests/data_test.py +484 -55
  68. ee/tests/daterange_test.py +4 -4
  69. ee/tests/deprecation_test.py +6 -4
  70. ee/tests/deserializer_test.py +64 -5
  71. ee/tests/dictionary_test.py +12 -12
  72. ee/tests/ee_array_test.py +3 -3
  73. ee/tests/ee_date_test.py +4 -4
  74. ee/tests/ee_list_test.py +3 -3
  75. ee/tests/ee_number_test.py +75 -30
  76. ee/tests/ee_string_test.py +11 -3
  77. ee/tests/ee_test.py +40 -22
  78. ee/tests/element_test.py +2 -2
  79. ee/tests/errormargin_test.py +1 -1
  80. ee/tests/feature_test.py +10 -10
  81. ee/tests/featurecollection_test.py +3 -3
  82. ee/tests/filter_test.py +4 -4
  83. ee/tests/function_test.py +5 -5
  84. ee/tests/geometry_point_test.py +3 -3
  85. ee/tests/geometry_test.py +93 -52
  86. ee/tests/image_converter_test.py +1 -3
  87. ee/tests/image_test.py +3 -3
  88. ee/tests/imagecollection_test.py +3 -3
  89. ee/tests/join_test.py +3 -3
  90. ee/tests/kernel_test.py +7 -3
  91. ee/tests/model_test.py +17 -5
  92. ee/tests/oauth_test.py +189 -7
  93. ee/tests/pixeltype_test.py +6 -7
  94. ee/tests/projection_test.py +5 -6
  95. ee/tests/reducer_test.py +16 -3
  96. ee/tests/serializer_test.py +39 -12
  97. ee/tests/table_converter_test.py +51 -7
  98. ee/tests/terrain_test.py +11 -3
  99. earthengine_api-1.5.13rc0.dist-info/RECORD +0 -107
  100. {earthengine_api-1.5.13rc0.dist-info → earthengine_api-1.7.4.dist-info}/entry_points.txt +0 -0
  101. {earthengine_api-1.5.13rc0.dist-info → earthengine_api-1.7.4.dist-info}/licenses/LICENSE +0 -0
  102. {earthengine_api-1.5.13rc0.dist-info → earthengine_api-1.7.4.dist-info}/top_level.txt +0 -0
ee/geometry.py CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- import collections.abc
5
+ from collections.abc import Iterable, Sequence
6
6
  import json
7
7
  import math
8
- from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
8
+ from typing import Any
9
9
 
10
10
  from ee import _arg_types
11
11
  from ee import _utils
@@ -17,7 +17,7 @@ from ee import ee_number
17
17
  from ee import ee_string
18
18
  from ee import ee_types
19
19
  from ee import featurecollection
20
- from ee import projection
20
+ from ee import projection as ee_projection
21
21
  from ee import serializer
22
22
 
23
23
 
@@ -36,13 +36,16 @@ class Geometry(computedobject.ComputedObject):
36
36
  @_utils.accept_opt_prefix('opt_proj', 'opt_geodesic', 'opt_evenOdd')
37
37
  def __init__(
38
38
  self,
39
- geo_json: Union[Dict[str, Any], computedobject.ComputedObject, Geometry],
40
- proj: Optional[Any] = None,
41
- geodesic: Optional[bool] = None,
42
- evenOdd: Optional[bool] = None, # pylint: disable=g-bad-name
39
+ geo_json: dict[str, Any] | computedobject.ComputedObject | Geometry,
40
+ proj: Any | None = None,
41
+ geodesic: bool | None = None,
42
+ evenOdd: bool | None = None, # pylint: disable=g-bad-name
43
43
  ):
44
44
  """Creates a geometry.
45
45
 
46
+ Note that a creating a Geometry from a ComputedObject cannot have have any
47
+ overrides from the arguments proj, geodesic, or evenOdd.
48
+
46
49
  Args:
47
50
  geo_json: The GeoJSON object describing the geometry or a computed object
48
51
  to be reinterpred as a Geometry. Supports CRS specifications as per the
@@ -56,8 +59,8 @@ class Geometry(computedobject.ComputedObject):
56
59
  geodesic: Whether line segments should be interpreted as spherical
57
60
  geodesics. If false, indicates that line segments should be interpreted
58
61
  as planar lines in the specified CRS. If absent, defaults to true if the
59
- CRS is geographic (including the default
60
- EPSG:4326), or to false if the CRS is projected.
62
+ CRS is geographic (including the default EPSG:4326), or to false if the
63
+ CRS is projected.
61
64
  evenOdd: If true, polygon interiors will be determined by the even/odd
62
65
  rule, where a point is inside if it crosses an odd number of edges to
63
66
  reach a point at infinity. Otherwise polygons use the left-inside rule,
@@ -70,15 +73,16 @@ class Geometry(computedobject.ComputedObject):
70
73
  self.initialize()
71
74
 
72
75
  # pylint: disable-next=protected-access
76
+ has_resolved_geometry_type = getattr(geo_json, '_type', None) is not None
73
77
  computed = isinstance(geo_json, computedobject.ComputedObject) and not (
74
- isinstance(geo_json, Geometry) and geo_json._type is not None
78
+ isinstance(geo_json, Geometry) and has_resolved_geometry_type
75
79
  )
76
- options = proj or geodesic or evenOdd
80
+ options = proj is not None or geodesic is not None or evenOdd is not None
77
81
  if computed:
78
82
  if options:
79
83
  raise ee_exception.EEException(
80
84
  'Setting the CRS or geodesic on a computed Geometry is not '
81
- 'supported. Use Geometry.transform().')
85
+ 'supported. Use Geometry.transform().')
82
86
  else:
83
87
  super().__init__(geo_json.func, geo_json.args, geo_json.varName)
84
88
  return
@@ -147,7 +151,7 @@ class Geometry(computedobject.ComputedObject):
147
151
  self._computed_equivalent = apifunction.ApiFunction.lookup(
148
152
  'GeometryConstructors.' + ctor_name).apply(ctor_args)
149
153
 
150
- def _get_name_from_crs(self, crs: Dict[str, Any]) -> str:
154
+ def _get_name_from_crs(self, crs: dict[str, Any]) -> str:
151
155
  """Returns projection name from a CRS."""
152
156
  if isinstance(crs, dict) and crs.get('type') == 'name':
153
157
  properties = crs.get('properties')
@@ -156,7 +160,7 @@ class Geometry(computedobject.ComputedObject):
156
160
  if isinstance(name, str):
157
161
  return name
158
162
  raise ee_exception.EEException(
159
- 'Invalid CRS declaration in GeoJSON: ' + json.dumps(crs)
163
+ f'Invalid CRS declaration in GeoJSON: {json.dumps(crs)}'
160
164
  )
161
165
 
162
166
  @classmethod
@@ -296,10 +300,10 @@ class Geometry(computedobject.ComputedObject):
296
300
 
297
301
  @staticmethod
298
302
  def BBox(
299
- west: Union[float, computedobject.ComputedObject],
300
- south: Union[float, computedobject.ComputedObject],
301
- east: Union[float, computedobject.ComputedObject],
302
- north: Union[float, computedobject.ComputedObject],
303
+ west: float | computedobject.ComputedObject,
304
+ south: float | computedobject.ComputedObject,
305
+ east: float | computedobject.ComputedObject,
306
+ north: float | computedobject.ComputedObject,
303
307
  ) -> Geometry:
304
308
  """Constructs a rectangle ee.Geometry from lines of latitude and longitude.
305
309
 
@@ -333,22 +337,20 @@ class Geometry(computedobject.ComputedObject):
333
337
  # support the general idea of an around-the-globe latitude band. By writing
334
338
  # them negated, we also reject NaN.
335
339
  if not west < math.inf:
336
- raise ee_exception.EEException(
337
- 'Geometry.BBox: west must not be {}'.format(west))
340
+ raise ee_exception.EEException(f'Geometry.BBox: west must not be {west}')
338
341
  if not east > -math.inf:
339
- raise ee_exception.EEException(
340
- 'Geometry.BBox: east must not be {}'.format(east))
342
+ raise ee_exception.EEException(f'Geometry.BBox: east must not be {east}')
341
343
  # Reject cases which, if we clamped them instead, would move a box whose
342
344
  # bounds lie entirely "past" a pole to being at the pole. By writing them
343
345
  # negated, we also reject NaN.
344
346
  if not south <= 90:
345
347
  raise ee_exception.EEException(
346
- 'Geometry.BBox: south must be at most +90°, but was {}°'.format(
347
- south))
348
+ f'Geometry.BBox: south must be at most +90°, but was {south}°'
349
+ )
348
350
  if not north >= -90:
349
351
  raise ee_exception.EEException(
350
- 'Geometry.BBox: north must be at least -90°, but was {}°'.format(
351
- north))
352
+ f'Geometry.BBox: north must be at least -90°, but was {north}°'
353
+ )
352
354
  # On the other hand, allow a box whose extent lies past the pole, but
353
355
  # canonicalize it to being exactly the pole.
354
356
  south = max(south, -90)
@@ -403,7 +405,7 @@ class Geometry(computedobject.ComputedObject):
403
405
  """Constructs an ee.Geometry describing a LineString.
404
406
 
405
407
  Args:
406
- coords: A list of at least two points. May be a list of coordinates in
408
+ coords: A list of at least two points. May be a list of coordinates in
407
409
  the GeoJSON 'LineString' format, a list of at least two ee.Geometry
408
410
  objects describing a point, or a list of at least four numbers
409
411
  defining the [x,y] coordinates of at least two points.
@@ -478,7 +480,7 @@ class Geometry(computedobject.ComputedObject):
478
480
  """Constructs an ee.Geometry describing a MultiLineString.
479
481
 
480
482
  Create a GeoJSON MultiLineString from either a list of points, or an array
481
- of lines (each an array of Points). If a list of points is specified,
483
+ of lines (each an array of Points). If a list of points is specified,
482
484
  only a single line is created.
483
485
 
484
486
  Args:
@@ -600,7 +602,7 @@ class Geometry(computedobject.ComputedObject):
600
602
  return Geometry(Geometry._parseArgs('MultiPolygon', 4, all_args))
601
603
 
602
604
  @_utils.accept_opt_prefix('opt_encoder')
603
- def encode(self, encoder: Optional[Any] = None) -> Dict[str, Any]:
605
+ def encode(self, encoder: Any | None = None) -> dict[str, Any]:
604
606
  """Returns a GeoJSON-compatible representation of the geometry."""
605
607
  if not getattr(self, '_type', None):
606
608
  return super().encode(encoder)
@@ -629,7 +631,7 @@ class Geometry(computedobject.ComputedObject):
629
631
 
630
632
  return self._computed_equivalent.encode_cloud_value(encoder)
631
633
 
632
- def toGeoJSON(self) -> Dict[str, Any]:
634
+ def toGeoJSON(self) -> dict[str, Any]:
633
635
  """Returns a GeoJSON representation of the geometry."""
634
636
  if self.func:
635
637
  raise ee_exception.EEException(
@@ -648,18 +650,18 @@ class Geometry(computedobject.ComputedObject):
648
650
  )
649
651
  return json.dumps(self.toGeoJSON())
650
652
 
651
- def serialize(self, for_cloud_api=True):
653
+ def serialize(self, for_cloud_api: bool = True) -> str:
652
654
  """Returns the serialized representation of this object."""
653
655
  return serializer.toJSON(self, for_cloud_api=for_cloud_api)
654
656
 
655
657
  def __str__(self) -> str:
656
- return 'ee.Geometry(%s)' % serializer.toReadableJSON(self)
658
+ return f'ee.Geometry({serializer.toReadableJSON(self)})'
657
659
 
658
660
  def __repr__(self) -> str:
659
661
  return self.__str__()
660
662
 
661
663
  @staticmethod
662
- def _isValidGeometry(geometry: Dict[str, Any]) -> bool:
664
+ def _isValidGeometry(geometry: dict[str, Any]) -> bool:
663
665
  """Check if a geometry looks valid.
664
666
 
665
667
  Args:
@@ -694,7 +696,7 @@ class Geometry(computedobject.ComputedObject):
694
696
  (nesting == 4 or not coords)))
695
697
 
696
698
  @staticmethod
697
- def _isValidCoordinates(shape: Union[Sequence[float], Geometry]) -> int:
699
+ def _isValidCoordinates(shape: Sequence[float] | Geometry) -> int:
698
700
  """Validate the coordinates of a geometry.
699
701
 
700
702
  Args:
@@ -703,10 +705,10 @@ class Geometry(computedobject.ComputedObject):
703
705
  Returns:
704
706
  The number of nested arrays or -1 on error.
705
707
  """
706
- if not isinstance(shape, collections.abc.Iterable):
708
+ if not isinstance(shape, Iterable):
707
709
  return -1
708
710
 
709
- if (shape and isinstance(shape[0], collections.abc.Iterable) and
711
+ if (shape and isinstance(shape[0], Iterable) and
710
712
  not isinstance(shape[0], str)):
711
713
  count = Geometry._isValidCoordinates(shape[0])
712
714
  # If more than 1 ring or polygon, they should have the same nesting.
@@ -731,7 +733,7 @@ class Geometry(computedobject.ComputedObject):
731
733
  """Create a line from a list of points.
732
734
 
733
735
  Args:
734
- coordinates: The points to convert. Must be list of numbers of
736
+ coordinates: The points to convert. Must be list of numbers of
735
737
  even length, in the format [x1, y1, x2, y2, ...]
736
738
 
737
739
  Returns:
@@ -743,16 +745,16 @@ class Geometry(computedobject.ComputedObject):
743
745
  return coordinates
744
746
  if len(coordinates) % 2 != 0:
745
747
  raise ee_exception.EEException(
746
- 'Invalid number of coordinates: %s' % len(coordinates))
748
+ f'Invalid number of coordinates: {len(coordinates)}'
749
+ )
747
750
 
748
- line = []
749
- for i in range(0, len(coordinates), 2):
750
- pt = [coordinates[i], coordinates[i + 1]]
751
- line.append(pt)
752
- return line
751
+ return [
752
+ [coordinates[i], coordinates[i + 1]]
753
+ for i in range(0, len(coordinates), 2)
754
+ ]
753
755
 
754
756
  @staticmethod
755
- def _parseArgs(ctor_name: str, depth: int, args: Any) -> Dict[str, Any]:
757
+ def _parseArgs(ctor_name: str, depth: int, args: Any) -> dict[str, Any]:
756
758
  """Parses arguments into a GeoJSON dictionary or a ComputedObject.
757
759
 
758
760
  Args:
@@ -870,7 +872,7 @@ class Geometry(computedobject.ComputedObject):
870
872
  return coords
871
873
 
872
874
  @staticmethod
873
- def _GetArgs(args, keywords: Tuple[str, ...] = (), **kwargs) -> List[Any]:
875
+ def _GetArgs(args, keywords: tuple[str, ...] = (), **kwargs) -> list[Any]:
874
876
  """Returns all args, specified or not, checking for keywords."""
875
877
  args = list(args)
876
878
  if keywords:
@@ -886,8 +888,8 @@ class Geometry(computedobject.ComputedObject):
886
888
  def area(
887
889
  self,
888
890
  # pylint: disable-next=invalid-name
889
- maxError: Optional[_arg_types.ErrorMargin] = None,
890
- proj: Optional[_arg_types.Projection] = None,
891
+ maxError: _arg_types.ErrorMargin | None = None,
892
+ proj: _arg_types.Projection | None = None,
891
893
  ) -> ee_number.Number:
892
894
  """Returns the area of the geometry.
893
895
 
@@ -909,8 +911,8 @@ class Geometry(computedobject.ComputedObject):
909
911
  def bounds(
910
912
  self,
911
913
  # pylint: disable-next=invalid-name
912
- maxError: Optional[_arg_types.ErrorMargin] = None,
913
- proj: Optional[_arg_types.Projection] = None,
914
+ maxError: _arg_types.ErrorMargin | None = None,
915
+ proj: _arg_types.Projection | None = None,
914
916
  ) -> Geometry:
915
917
  """Returns the bounding rectangle of the geometry.
916
918
 
@@ -929,8 +931,8 @@ class Geometry(computedobject.ComputedObject):
929
931
  self,
930
932
  distance: _arg_types.Number,
931
933
  # pylint: disable-next=invalid-name
932
- maxError: Optional[_arg_types.ErrorMargin] = None,
933
- proj: Optional[_arg_types.Projection] = None,
934
+ maxError: _arg_types.ErrorMargin | None = None,
935
+ proj: _arg_types.Projection | None = None,
934
936
  ) -> Geometry:
935
937
  """Returns the input buffered by a given distance.
936
938
 
@@ -957,8 +959,8 @@ class Geometry(computedobject.ComputedObject):
957
959
  def centroid(
958
960
  self,
959
961
  # pylint: disable-next=invalid-name
960
- maxError: Optional[_arg_types.ErrorMargin] = None,
961
- proj: Optional[_arg_types.Projection] = None,
962
+ maxError: _arg_types.ErrorMargin | None = None,
963
+ proj: _arg_types.Projection | None = None,
962
964
  ) -> Geometry:
963
965
  """Returns a point at the center of the highest-dimension components.
964
966
 
@@ -981,8 +983,8 @@ class Geometry(computedobject.ComputedObject):
981
983
  self,
982
984
  right: _arg_types.Geometry,
983
985
  # pylint: disable-next=invalid-name
984
- maxError: Optional[_arg_types.ErrorMargin] = None,
985
- proj: Optional[_arg_types.Projection] = None,
986
+ maxError: _arg_types.ErrorMargin | None = None,
987
+ proj: _arg_types.Projection | None = None,
986
988
  ) -> computedobject.ComputedObject:
987
989
  """Returns the point on the right input that is nearest to the left input.
988
990
 
@@ -1010,8 +1012,8 @@ class Geometry(computedobject.ComputedObject):
1010
1012
  self,
1011
1013
  right: _arg_types.Geometry,
1012
1014
  # pylint: disable-next=invalid-name
1013
- maxError: Optional[_arg_types.ErrorMargin] = None,
1014
- proj: Optional[_arg_types.Projection] = None,
1015
+ maxError: _arg_types.ErrorMargin | None = None,
1016
+ proj: _arg_types.Projection | None = None,
1015
1017
  ) -> computedobject.ComputedObject:
1016
1018
  """Returns the points on the right input that are nearest to the left input.
1017
1019
 
@@ -1042,8 +1044,8 @@ class Geometry(computedobject.ComputedObject):
1042
1044
  self,
1043
1045
  right: _arg_types.Geometry,
1044
1046
  # pylint: disable-next=invalid-name
1045
- maxError: Optional[_arg_types.ErrorMargin] = None,
1046
- proj: Optional[_arg_types.Projection] = None,
1047
+ maxError: _arg_types.ErrorMargin | None = None,
1048
+ proj: _arg_types.Projection | None = None,
1047
1049
  ) -> computedobject.ComputedObject:
1048
1050
  """Returns true if and only if one geometry is contained in the other.
1049
1051
 
@@ -1067,8 +1069,8 @@ class Geometry(computedobject.ComputedObject):
1067
1069
  self,
1068
1070
  right: _arg_types.Geometry,
1069
1071
  # pylint: disable-next=invalid-name
1070
- maxError: Optional[_arg_types.ErrorMargin] = None,
1071
- proj: Optional[_arg_types.Projection] = None,
1072
+ maxError: _arg_types.ErrorMargin | None = None,
1073
+ proj: _arg_types.Projection | None = None,
1072
1074
  ) -> computedobject.ComputedObject:
1073
1075
  """Returns true if and only if one geometry contains the other.
1074
1076
 
@@ -1091,8 +1093,8 @@ class Geometry(computedobject.ComputedObject):
1091
1093
  def convexHull(
1092
1094
  self,
1093
1095
  # pylint: disable-next=invalid-name
1094
- maxError: Optional[_arg_types.ErrorMargin] = None,
1095
- proj: Optional[_arg_types.Projection] = None,
1096
+ maxError: _arg_types.ErrorMargin | None = None,
1097
+ proj: _arg_types.Projection | None = None,
1096
1098
  ) -> Geometry:
1097
1099
  """Returns the convex hull of the given geometry.
1098
1100
 
@@ -1121,7 +1123,7 @@ class Geometry(computedobject.ComputedObject):
1121
1123
  def coveringGrid(
1122
1124
  self,
1123
1125
  proj: _arg_types.Projection,
1124
- scale: Optional[_arg_types.Number] = None,
1126
+ scale: _arg_types.Number | None = None,
1125
1127
  ) -> featurecollection.FeatureCollection:
1126
1128
  """Returns a collection of features that cover this geometry.
1127
1129
 
@@ -1145,8 +1147,8 @@ class Geometry(computedobject.ComputedObject):
1145
1147
  self,
1146
1148
  distances: _arg_types.List,
1147
1149
  # pylint: disable-next=invalid-name
1148
- maxError: Optional[_arg_types.ErrorMargin] = None,
1149
- proj: Optional[_arg_types.Projection] = None,
1150
+ maxError: _arg_types.ErrorMargin | None = None,
1151
+ proj: _arg_types.Projection | None = None,
1150
1152
  ) -> Geometry:
1151
1153
  """Returns geometries cut into pieces along the given distances.
1152
1154
 
@@ -1173,8 +1175,8 @@ class Geometry(computedobject.ComputedObject):
1173
1175
  self,
1174
1176
  right: _arg_types.Geometry,
1175
1177
  # pylint: disable-next=invalid-name
1176
- maxError: Optional[_arg_types.ErrorMargin] = None,
1177
- proj: Optional[_arg_types.Projection] = None,
1178
+ maxError: _arg_types.ErrorMargin | None = None,
1179
+ proj: _arg_types.Projection | None = None,
1178
1180
  ) -> Geometry:
1179
1181
  """Returns the result of subtracting the 'right' geometry from the geometry.
1180
1182
 
@@ -1195,8 +1197,8 @@ class Geometry(computedobject.ComputedObject):
1195
1197
  self,
1196
1198
  right: _arg_types.Geometry,
1197
1199
  # pylint: disable-next=invalid-name
1198
- maxError: Optional[_arg_types.ErrorMargin] = None,
1199
- proj: Optional[_arg_types.Projection] = None,
1200
+ maxError: _arg_types.ErrorMargin | None = None,
1201
+ proj: _arg_types.Projection | None = None,
1200
1202
  ) -> computedobject.ComputedObject:
1201
1203
  """Returns true if and only if the geometries are disjoint.
1202
1204
 
@@ -1219,8 +1221,8 @@ class Geometry(computedobject.ComputedObject):
1219
1221
  def dissolve(
1220
1222
  self,
1221
1223
  # pylint: disable-next=invalid-name
1222
- maxError: Optional[_arg_types.ErrorMargin] = None,
1223
- proj: Optional[_arg_types.Projection] = None,
1224
+ maxError: _arg_types.ErrorMargin | None = None,
1225
+ proj: _arg_types.Projection | None = None,
1224
1226
  ) -> Geometry:
1225
1227
  """Returns the union of the geometry.
1226
1228
 
@@ -1241,9 +1243,9 @@ class Geometry(computedobject.ComputedObject):
1241
1243
  self,
1242
1244
  right: _arg_types.Geometry,
1243
1245
  # pylint: disable-next=invalid-name
1244
- maxError: Optional[_arg_types.ErrorMargin] = None,
1245
- proj: Optional[_arg_types.Projection] = None,
1246
- spherical: Optional[_arg_types.Bool] = None,
1246
+ maxError: _arg_types.ErrorMargin | None = None,
1247
+ proj: _arg_types.Projection | None = None,
1248
+ spherical: _arg_types.Bool | None = None,
1247
1249
  ) -> ee_number.Number:
1248
1250
  """Returns the minimum distance between two geometries.
1249
1251
 
@@ -1325,8 +1327,8 @@ class Geometry(computedobject.ComputedObject):
1325
1327
  self,
1326
1328
  right: _arg_types.Geometry,
1327
1329
  # pylint: disable-next=invalid-name
1328
- maxError: Optional[_arg_types.ErrorMargin] = None,
1329
- proj: Optional[_arg_types.Projection] = None,
1330
+ maxError: _arg_types.ErrorMargin | None = None,
1331
+ proj: _arg_types.Projection | None = None,
1330
1332
  ) -> Geometry:
1331
1333
  """Returns the intersection of the two geometries.
1332
1334
 
@@ -1347,8 +1349,8 @@ class Geometry(computedobject.ComputedObject):
1347
1349
  self,
1348
1350
  right: _arg_types.Geometry,
1349
1351
  # pylint: disable-next=invalid-name
1350
- maxError: Optional[_arg_types.ErrorMargin] = None,
1351
- proj: Optional[_arg_types.Projection] = None,
1352
+ maxError: _arg_types.ErrorMargin | None = None,
1353
+ proj: _arg_types.Projection | None = None,
1352
1354
  ) -> computedobject.ComputedObject:
1353
1355
  """Returns true if and only if the geometries intersect.
1354
1356
 
@@ -1376,8 +1378,8 @@ class Geometry(computedobject.ComputedObject):
1376
1378
  def length(
1377
1379
  self,
1378
1380
  # pylint: disable-next=invalid-name
1379
- maxError: Optional[_arg_types.ErrorMargin] = None,
1380
- proj: Optional[_arg_types.Projection] = None,
1381
+ maxError: _arg_types.ErrorMargin | None = None,
1382
+ proj: _arg_types.Projection | None = None,
1381
1383
  ) -> ee_number.Number:
1382
1384
  """Returns the length of the linear parts of the geometry.
1383
1385
 
@@ -1398,8 +1400,8 @@ class Geometry(computedobject.ComputedObject):
1398
1400
  def perimeter(
1399
1401
  self,
1400
1402
  # pylint: disable-next=invalid-name
1401
- maxError: Optional[_arg_types.ErrorMargin] = None,
1402
- proj: Optional[_arg_types.Projection] = None,
1403
+ maxError: _arg_types.ErrorMargin | None = None,
1404
+ proj: _arg_types.Projection | None = None,
1403
1405
  ) -> ee_number.Number:
1404
1406
  """Returns the perimeter length of the polygonal parts of the geometry.
1405
1407
 
@@ -1417,7 +1419,7 @@ class Geometry(computedobject.ComputedObject):
1417
1419
  self.name() + '.perimeter', self, maxError, proj
1418
1420
  )
1419
1421
 
1420
- def projection(self) -> projection.Projection:
1422
+ def projection(self) -> ee_projection.Projection:
1421
1423
  """Returns the projection of the geometry."""
1422
1424
 
1423
1425
  return apifunction.ApiFunction.call_(self.name() + '.projection', self)
@@ -1436,7 +1438,7 @@ class Geometry(computedobject.ComputedObject):
1436
1438
  def simplify(
1437
1439
  self,
1438
1440
  maxError: _arg_types.ErrorMargin, # pylint: disable=invalid-name
1439
- proj: Optional[_arg_types.Projection] = None,
1441
+ proj: _arg_types.Projection | None = None,
1440
1442
  ) -> Geometry:
1441
1443
  """Returns a simplified geometry to within a given error margin.
1442
1444
 
@@ -1467,8 +1469,8 @@ class Geometry(computedobject.ComputedObject):
1467
1469
  self,
1468
1470
  right: _arg_types.Geometry,
1469
1471
  # pylint: disable-next=invalid-name
1470
- maxError: Optional[_arg_types.ErrorMargin] = None,
1471
- proj: Optional[_arg_types.Projection] = None,
1472
+ maxError: _arg_types.ErrorMargin | None = None,
1473
+ proj: _arg_types.Projection | None = None,
1472
1474
  ) -> Geometry:
1473
1475
  """Returns the symmetric difference between two geometries.
1474
1476
 
@@ -1487,9 +1489,9 @@ class Geometry(computedobject.ComputedObject):
1487
1489
 
1488
1490
  def transform(
1489
1491
  self,
1490
- proj: Optional[_arg_types.Projection] = None,
1492
+ proj: _arg_types.Projection | None = None,
1491
1493
  # pylint: disable-next=invalid-name
1492
- maxError: Optional[_arg_types.ErrorMargin] = None,
1494
+ maxError: _arg_types.ErrorMargin | None = None,
1493
1495
  ) -> Geometry:
1494
1496
  """Returns the geometry Transformed to a specific projection.
1495
1497
 
@@ -1514,8 +1516,8 @@ class Geometry(computedobject.ComputedObject):
1514
1516
  self,
1515
1517
  right: _arg_types.Geometry,
1516
1518
  # pylint: disable-next=invalid-name
1517
- maxError: Optional[_arg_types.ErrorMargin] = None,
1518
- proj: Optional[_arg_types.Projection] = None,
1519
+ maxError: _arg_types.ErrorMargin | None = None,
1520
+ proj: _arg_types.Projection | None = None,
1519
1521
  ) -> Geometry:
1520
1522
  """Returns the union of the two geometries.
1521
1523
 
@@ -1537,8 +1539,8 @@ class Geometry(computedobject.ComputedObject):
1537
1539
  right: _arg_types.Geometry,
1538
1540
  distance: _arg_types.Number,
1539
1541
  # pylint: disable-next=invalid-name
1540
- maxError: Optional[_arg_types.ErrorMargin] = None,
1541
- proj: Optional[_arg_types.Projection] = None,
1542
+ maxError: _arg_types.ErrorMargin | None = None,
1543
+ proj: _arg_types.Projection | None = None,
1542
1544
  ) -> computedobject.ComputedObject:
1543
1545
  """Returns true if the geometries are within a specified distance.
1544
1546