diff --git a/environment.yml b/environment.yml index 4c028f23b..54495e3f7 100644 --- a/environment.yml +++ b/environment.yml @@ -13,10 +13,6 @@ dependencies: - shapely>=2.0 - pyshp>=2.3.1 - pyproj>=3.6.0 - # PROJ 9.8 changes the way equicylindrical projections (PlateCarree) - # are transformed, which causes some issues. Temporary pin PROJ < 9.8 - # to avoid these for now. - - proj<9.8 # The testing label has the proper version of freetype included - conda-forge/label/testing::matplotlib-base>=3.6 diff --git a/lib/cartopy/crs.py b/lib/cartopy/crs.py index 500057ade..6e53e45ab 100644 --- a/lib/cartopy/crs.py +++ b/lib/cartopy/crs.py @@ -1352,10 +1352,7 @@ def _ellipse_boundary(semimajor=2, semiminor=1, easting=0, northing=0, n=201): class PlateCarree(_CylindricalProjection): def __init__(self, central_longitude=0.0, globe=None): globe = globe or Globe(semimajor_axis=WGS84_SEMIMAJOR_AXIS) - proj4_params = [('proj', 'eqc'), ('lon_0', central_longitude), - ('to_meter', math.radians(1) * ( - globe.semimajor_axis or WGS84_SEMIMAJOR_AXIS)), - ('vto_meter', 1)] + proj4_params = [('proj', 'latlong'), ('pm', central_longitude)] x_max = 180 y_max = 90 # Set the threshold around 0.5 if the x max is 180. @@ -1385,8 +1382,8 @@ def _bbox_and_offset(self, other_plate_carree): central longitudes. No checking of this is done. """ - self_lon_0 = self.proj4_params['lon_0'] - other_lon_0 = other_plate_carree.proj4_params['lon_0'] + self_lon_0 = self.proj4_params['pm'] + other_lon_0 = other_plate_carree.proj4_params['pm'] lon_0_offset = other_lon_0 - self_lon_0 @@ -1414,7 +1411,8 @@ def quick_vertices_transform(self, vertices, src_crs): if return_value is None and isinstance(src_crs, PlateCarree): self_params = self.proj4_params.copy() src_params = src_crs.proj4_params.copy() - self_params.pop('lon_0'), src_params.pop('lon_0') + self_params.pop('pm') + src_params.pop('pm') xs, ys = vertices[:, 0], vertices[:, 1] @@ -1440,6 +1438,12 @@ def quick_vertices_transform(self, vertices, src_crs): return return_value + def as_geodetic(self): + from pyproj import CRS as P_CRS + d = self.geodetic_crs.to_json_dict() + d['datum'].pop('prime_meridian', None) + return CRS(P_CRS.from_json_dict(d)) + class TransverseMercator(Projection): """ diff --git a/lib/cartopy/tests/mpl/test_gridliner.py b/lib/cartopy/tests/mpl/test_gridliner.py index 661440707..3d78552bc 100644 --- a/lib/cartopy/tests/mpl/test_gridliner.py +++ b/lib/cartopy/tests/mpl/test_gridliner.py @@ -11,7 +11,7 @@ import matplotlib.ticker as mticker import numpy as np import pytest -from shapely.geos import geos_version +from shapely import geos_version import cartopy.crs as ccrs from cartopy.mpl.geoaxes import GeoAxes