Skip to content

Shapefile gives warning with GSHHS feature #1659

@MHBalsmeier

Description

@MHBalsmeier

Hi,
shapefile gives me a warning when I save a figure which has GSHHS features in it. Thought I'd ask it here:

MWE:

import matplotlib.pyplot as plt;
import cartopy.crs as ccrs;
import cartopy;
fig = plt.figure();
proj = ccrs.Mercator(central_longitude = 0);
ax = plt.axes(projection = proj);
ax.add_feature(cartopy.feature.GSHHSFeature(levels = (1, 2), linewidth = 2.0));
print("before");
fig.savefig("test.png");
print("after");

output:

before

/home/max/.local/lib/python3.8/site-packages/shapefile.py:385: UserWarning: Shapefile shape has invalid polygon: no exterior rings found (must have clockwise orientation); interpreting holes as exteriors.
  warnings.warn('Shapefile shape has invalid polygon: no exterior rings found (must have clockwise orientation); interpreting holes as exteriors.')

after

What is the cause of this and how can it be resolved?

OS: Ubuntu 20.04
Cartopy: 0.18.0
pyshp: 2.1.2

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions