Skip to content

Oceans wrongly displayed with TransverseMercator and central_longitude #1685

@Dapid

Description

@Dapid

Description

Oceans from Natural Earth do not display correctly with TransverseMercator setting cenral_longitude to other than 0.
The whole Earth appears covered in water, several times judging for the opacity.

Other projections seem to work fine, and other elements of PhysicalEarth work as well.

Code to reproduce

This code includes working and non working pieces. Select the first PROJECTION to see the bug.

import cartopy.feature as cfeature
from cartopy import crs as ccrs

import pylab as plt


PLATE_CARREE = ccrs.PlateCarree()

# This projection doesn't work:
PROJECTION = ccrs.TransverseMercator(central_longitude=15, scale_factor=0.9996, approx=False)

# These do
PROJECTION = PLATE_CARREE
PROJECTION = ccrs.AlbersEqualArea()
PROJECTION = ccrs.TransverseMercator(central_longitude=0, scale_factor=0.9996, approx=False)
PROJECTION = ccrs.Mercator(central_longitude=15)

lat = [59.234952, 59.561187, 60.0401]
lon = [17.851566000000002, 17.552861, 18.680685999999998]

fig, ax = plt.subplots(1, 1, subplot_kw={'projection': PROJECTION})

ax.scatter(lon, lat, transform=PLATE_CARREE)


lakes_10m = cfeature.NaturalEarthFeature('physical', 'lakes', '10m',
                                         edgecolor='b', facecolor='b', alpha=0.1)
ocean_10m = cfeature.NaturalEarthFeature('physical', 'ocean', '10m',
                                         edgecolor='b', facecolor='b', alpha=0.1)
ax.add_feature(lakes_10m) # This one works
ax.add_feature(ocean_10m) # This doesn't

plt.show()

Full environment definition

Operating system

Fedora 32

Cartopy version

0.18.1.dev125+gd12c86c

pip list

Package                       Version                Location
----------------------------- ---------------------- ------------------------------------
absl-py                       0.10.0
affine                        2.3.0
alabaster                     0.7.12
alphashape                    1.1.0
amply                         0.1.2
appdirs                       1.4.4
argon2-cffi                   20.1.0
astunparse                    1.6.3
async-generator               1.10
attrs                         19.3.0
autopep8                      1.5.4
Babel                         2.8.0
backcall                      0.2.0
bleach                        3.1.5
boto3                         1.14.34
botocore                      1.17.34
branca                        0.4.1
cached-property               1.5.2
cachetools                    4.1.1
calmap                        0.0.8
calplot                       0.1.4
Cartopy                       0.18.1.dev125+gd12c86c
certifi                       2020.6.20
cffi                          1.14.1
chardet                       3.0.4
click                         7.1.2
click-log                     0.3.2
click-plugins                 1.1.1
cligj                         0.5.0
ConfigArgParse                1.2.3
contextily                    1.0.0
cycler                        0.10.0
Cython                        0.29.21
datrie                        0.8.2
decorator                     4.4.2
defusedxml                    0.6.0
descartes                     1.1.0
docutils                      0.16
entrypoints                   0.3
ey                            0.3.0
Fiona                         1.8.13.post1
folium                        0.11.0
gast                          0.3.3
geographiclib                 1.50
geopandas                     0.8.1
geopy                         2.0.0
gitdb                         4.0.5
GitPython                     3.1.7
google-auth                   1.21.3
google-auth-oauthlib          0.4.1
google-pasta                  0.2.0
grpcio                        1.32.0
h5py                          2.10.0
idna                          2.10
imagesize                     1.2.0
importlib-metadata            3.0.0
importlib-resources           3.3.0
ipykernel                     5.3.4
ipyparallel                   6.3.0
ipython                       7.19.0
ipython-genutils              0.2.0
ipywidgets                    7.5.1
isodate                       0.6.0
jedi                          0.17.2
Jinja2                        2.11.2
jmespath                      0.10.0
joblib                        0.17.0
jsonschema                    3.2.0
jupyter-client                6.1.7
jupyter-core                  4.7.0
jupyter-tabnine               1.1.0
jupyterlab-pygments           0.1.2
jupytext                      1.6.0
keplergl                      0.2.1
Keras-Preprocessing           1.1.2
kiwisolver                    1.2.0
lockfile                      0.12.2
Markdown                      3.3.3
markdown-it-py                0.5.4
MarkupSafe                    1.1.1
matplotlib                    3.3.2
mercantile                    1.1.6
mistune                       0.8.4
mplleaflet                    0.0.5
munch                         2.5.0
nbclient                      0.5.0
nbconvert                     6.0.7
nbformat                      5.0.8
nest-asyncio                  1.4.0
networkx                      2.5
nose                          1.3.7
notebook                      6.1.5
numexpr                       2.7.1
numpy                         1.19.4
oauthlib                      3.1.0
opt-einsum                    3.3.0
osmnet                        0.1.6
osmnx                         0.16.2
OWSLib                        0.20.0
packaging                     20.4
pandana                       0.6
pandas                        1.1.4
pandocfilters                 1.4.2
parso                         0.7.1
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        8.0.1
pip                           20.2.4
prometheus-client             0.8.0
prompt-toolkit                3.0.5
protobuf                      3.12.4
psutil                        5.7.2
psycopg2-binary               2.8.5
ptyprocess                    0.6.0
PuLP                          2.3
pyarrow                       2.0.0
pyasn1                        0.4.8
pyasn1-modules                0.2.8
pycodestyle                   2.6.0
pycparser                     2.20
Pygments                      2.7.1
pyparsing                     2.4.7
pyproj                        2.6.1.post1
PyQt5                         5.13.2
PyQt5-sip                     12.8.0
pyrsistent                    0.16.0
pyshp                         2.1.0
python-daemon                 2.2.4
python-dateutil               2.8.1
pytz                          2020.1
PyYAML                        5.3.1
pyzmq                         19.0.2
qtconsole                     4.7.5
QtPy                          1.9.0
rasterio                      1.1.6
ratelimiter                   1.2.0.post0
rdflib                        5.0.0
rdflib-jsonld                 0.5.0
requests                      2.24.0
requests-oauthlib             1.3.0
rsa                           4.6
Rtree                         0.9.4
s3transfer                    0.3.3
scikit-learn                  0.23.2
scipy                         1.5.4
Send2Trash                    1.5.0
setuptools                    50.3.2
Shapely                       1.7.0
six                           1.15.0
sklearn                       0.0
smmap                         3.0.4
snakemake                     5.29.0
snakeviz                      2.1.0
snowballstemmer               2.0.0
snuggs                        1.4.7
Sphinx                        3.1.2
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        1.0.3
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.4
sweetviz                      1.1.1
tables                        3.6.1
tensorboard                   2.3.0
tensorboard-plugin-wit        1.7.0
tensorflow-cpu                2.3.1
tensorflow-estimator          2.3.0
termcolor                     1.1.0
terminado                     0.8.3
testpath                      0.4.4
threadpoolctl                 2.1.0
toml                          0.10.1
toposort                      1.5
tornado                       5.1.1
tqdm                          4.53.0
traitlets                     4.3.3
traittypes                    0.2.1
urbanaccess                   0.2.2
urllib3                       1.25.10
wcwidth                       0.2.5
webencodings                  0.5.1
Werkzeug                      1.0.1
wheel                         0.35.1
widgetsnbextension            3.5.1
wrapt                         1.12.1
xarray                        0.16.0
zipp                          3.1.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions