You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The shape file issue I'm having was closed on the cartopy site by upgrading to the latest gshhg-gmt. (SciTools/cartopy#1659). I have the latest version of the gshhg-gmt files. I'm using using pyshp==2.1.3 and the cartopy reference is using pyshp==2.1.2. I have not tried to use pyshp==2.1.2.
Please advise.
Using this OS and listed python modules below.
OS sles:15:sp2
Python 3.8.6
pyshp==2.1.3
Shape files : gshhg-gmt-2.3.7
/apps/prod/python-modules/3.8.6/intel/19.1.3.304/lib/python3.8/site-packages/shapefile.py:391: 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.')
The text was updated successfully, but these errors were encountered:
Thanks for raising this issue. In short, this is nothing to worry about, it's just a warning. The warning indicates that the GSHHS shapefile (GSHHS_c_L1.shp in the cartopoy repo) contains some incorrectly written shapes which may have resulted in incorrect GeoJSON representation of the shapefile. After some digging, the culprits are the shapes at index 95 and 471, which probably are just buggy artifacts. For instance, shape 95 only has a single polygon ring and yet that ring has a counter-clockwise orientation (positive area) which according to the shapefile spec is reserved for polygon holes:
Because a hole without a polygon exterior doesn't make much sense, PyShp displays a warning. It means that either the shape in the original shapefile was supposed to be a polygon exterior but was written using the wrong orientation, or that it was truly a hole and was accidentally written to the file. To preserve as much of the data as possible, PyShp makes the assumption that it was intended to be an polygon exterior and includes them in the GeoJSON as such, and notifies the user about the issue.
The warning messages were not necessarily the most informative, so I just added improvements that makes this more clear and also reports the shapefile index of the affected shapes. Should be available in the next version.
Included in the latest v2.2.0. Now prints logging.warning() with info for each shape where this happens so that the user can actually do something about it. To suppress the warnings, the user can set shapefile.VERBOSE = False.
The shape file issue I'm having was closed on the cartopy site by upgrading to the latest gshhg-gmt. (SciTools/cartopy#1659). I have the latest version of the gshhg-gmt files. I'm using using pyshp==2.1.3 and the cartopy reference is using pyshp==2.1.2. I have not tried to use pyshp==2.1.2.
Please advise.
Using this OS and listed python modules below.
OS sles:15:sp2
Python 3.8.6
pyshp==2.1.3
Shape files : gshhg-gmt-2.3.7
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");
/apps/prod/python-modules/3.8.6/intel/19.1.3.304/lib/python3.8/site-packages/shapefile.py:391: 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.')
The text was updated successfully, but these errors were encountered: