Skip to content

Commit beb74a8

Browse files
remove unused check_geographic_crs function #883
1 parent 59decc8 commit beb74a8

1 file changed

Lines changed: 20 additions & 31 deletions

File tree

openeo/extra/job_management/_job_splitting.py

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,6 @@
1212

1313
_log = logging.getLogger(__name__)
1414

15-
16-
def _is_geographic_crs(epsg: int) -> bool:
17-
"""Return ``True`` when *epsg* refers to a geographic (lon/lat) CRS."""
18-
try:
19-
import pyproj
20-
21-
return pyproj.CRS.from_epsg(epsg).is_geographic
22-
except Exception:
23-
return False
24-
25-
2615
class JobSplittingFailure(Exception):
2716
pass
2817

@@ -78,31 +67,31 @@ def _parse_input_geometry(
7867
"Invalid bounding box: south must be less than north."
7968
)
8069

81-
if bbox["west"] > bbox["east"]:
82-
# In a geographic CRS this indicates an antimeridian crossing;
83-
# split into two polygons on each side of the ±180° meridian.
84-
if source_epsg is not None and _is_geographic_crs(source_epsg):
85-
_log.info(
86-
"Bounding box crosses the antimeridian (west=%s > east=%s); "
87-
"splitting into two polygons.",
88-
bbox["west"],
89-
bbox["east"],
90-
)
91-
west_part = shapely.geometry.box(bbox["west"], bbox["south"], 180.0, bbox["north"])
92-
east_part = shapely.geometry.box(-180.0, bbox["south"], bbox["east"], bbox["north"])
93-
return MultiPolygon([west_part, east_part]), source_epsg
94-
raise JobSplittingFailure(
95-
"Invalid bounding box: west must be less than east. "
96-
"Antimeridian-crossing bounding boxes are only supported "
97-
"for geographic CRSs (e.g. EPSG:4326) with an explicit 'crs' field."
98-
)
99-
10070
if bbox["west"] == bbox["east"]:
10171
raise JobSplittingFailure(
10272
"Invalid bounding box: west must not equal east (zero-width bounding box)."
10373
)
10474

105-
return bbox.as_polygon(), source_epsg
75+
# if bbox["west"] > bbox["east"]:
76+
# # In a geographic CRS this indicates an antimeridian crossing;
77+
# # split into two polygons on each side of the ±180° meridian.
78+
# if source_epsg is not None and _is_geographic_crs(source_epsg):
79+
# _log.info(
80+
# "Bounding box crosses the antimeridian (west=%s > east=%s); "
81+
# "splitting into two polygons.",
82+
# bbox["west"],
83+
# bbox["east"],
84+
# )
85+
# west_part = shapely.geometry.box(bbox["west"], bbox["south"], 180.0, bbox["north"])
86+
# east_part = shapely.geometry.box(-180.0, bbox["south"], bbox["east"], bbox["north"])
87+
# return MultiPolygon([west_part, east_part]), source_epsg
88+
# raise JobSplittingFailure(
89+
# "Invalid bounding box: west must be less than east. "
90+
# "Antimeridian-crossing bounding boxes are only supported "
91+
# "for geographic CRSs (e.g. EPSG:4326) with an explicit 'crs' field."
92+
# )
93+
94+
return bbox.as_geometry(), source_epsg
10695
elif isinstance(geometry, (Polygon, MultiPolygon)):
10796
return geometry, None
10897
else:

0 commit comments

Comments
 (0)