|
12 | 12 |
|
13 | 13 | _log = logging.getLogger(__name__) |
14 | 14 |
|
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 | | - |
26 | 15 | class JobSplittingFailure(Exception): |
27 | 16 | pass |
28 | 17 |
|
@@ -78,31 +67,31 @@ def _parse_input_geometry( |
78 | 67 | "Invalid bounding box: south must be less than north." |
79 | 68 | ) |
80 | 69 |
|
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 | | - |
100 | 70 | if bbox["west"] == bbox["east"]: |
101 | 71 | raise JobSplittingFailure( |
102 | 72 | "Invalid bounding box: west must not equal east (zero-width bounding box)." |
103 | 73 | ) |
104 | 74 |
|
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 |
106 | 95 | elif isinstance(geometry, (Polygon, MultiPolygon)): |
107 | 96 | return geometry, None |
108 | 97 | else: |
|
0 commit comments