Converting the 10m resolution ocean shapefile from Natural Earth to a different projection "inverts" the shapefile ("drying up the ocean"):
import geopandas as gpd
oceans = gpd.read_file('./ne_10m_ocean')
oceans.plot()
Ok, here the ocean is nice and blue 🐟
But converting to another projection, centered in Nigeria (ESRI:102022), we get this:
oceans.to_crs("ESRI:102022").plot()
What is going on here? How can I re-fill the ocean?
Thanks to the hint by Ian Turton, I found a simple solution that uses GeoPandas: I clipped the oceans shapefile to the area I want to plot, thereby avoiding polygons being turned "inside-out":
target_projection = "ESRI:102022"
lower_left = gpd.points_from_xy(
x = [2.6], # longitude
y = [5.725311], # latitude
crs='EPSG:4326' # = WGS 84
)
upper_right = gpd.points_from_xy(
x = [7.7], # longitude
y = [9.3], # latitude
crs='EPSG:4326' # = WGS 84
)
oceans = gpd.read_file('./ne_10m_ocean')
oceans_clipped = oceans.clip(
mask=[
lower_left.x[0],
lower_left.y[0],
upper_right.x[0],
upper_right.x[0]
]
)