Skip to content

Commit 8f5bca1

Browse files
committed
Backport fix for country borders disappearing
1 parent cc314d5 commit 8f5bca1

File tree

2 files changed

+38
-8
lines changed

2 files changed

+38
-8
lines changed

CHANGELOG.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,23 @@ https://semver.org/spec/v2.0.0.html
1616
- Fix `GeosLibrary` wrapper to also work with CMake >= 3.27.0 and
1717
Python 2.7 on Windows by adding '/MANIFEST:NO' to override the new
1818
default '/MANIFEST:EMBED,ID=2' provided to linker.
19-
- Fix references to removed `numpy.float` alias (solves issue [#589],
20-
thanks to @quickbrett).
21-
- Fix bug with elliptical maps causing warped images (Blue Marble,
22-
ETOPO, Shaded Relief) to be shown behind the map background when the
23-
map boundary is not initialised manually (solves issue [#577], thanks
24-
to @YilongWang).
19+
- Fix broken `Proj.__call__` when the input arguments are provided as
20+
a combined single array.
2521
- Fix flipped coastlines with pseudocylindrical projections when `lon_0`
2622
is greater than 0 deg (solves issues [#443] and [#463], thanks to
2723
@YilongWang).
28-
- Fix broken `Proj.__call__` when the input arguments are provided as
29-
a combined single array.
3024
- Fix `antialiased` argument being ignored in `Basemap.drawcounties` and
3125
`Basemap.readshapefile` (solves issue [#501], thanks to @TheFizzWare).
26+
- Fix `BaseGeometry.intersection` in `_geoslib` so that it also works
27+
with `GEOS_GEOMETRYCOLLECTION` objects returned by `GEOSIntersection`
28+
(solves issue [#566], where country boundaries are missing due to this
29+
bug, thanks to @guidocioni).
30+
- Fix bug with elliptical maps causing warped images (Blue Marble,
31+
ETOPO, Shaded Relief) to be shown behind the map background when the
32+
map boundary is not initialised manually (solves issue [#577], thanks
33+
to @YilongWang).
34+
- Fix references to removed `numpy.float` alias (solves issue [#589],
35+
thanks to @quickbrett).
3236
- Fix wrong reference to `ireland.py` example in FAQ, which should be
3337
`hires.py` instead, and fix wrong use of locals and invalid syntax
3438
in this example (solves issue [#592], thanks to @timcoote).
@@ -1017,6 +1021,8 @@ https://github.com/matplotlib/basemap/issues/579
10171021
https://github.com/matplotlib/basemap/issues/577
10181022
[#573]:
10191023
https://github.com/matplotlib/basemap/issues/573
1024+
[#566]:
1025+
https://github.com/matplotlib/basemap/issues/566
10201026
[#564]:
10211027
https://github.com/matplotlib/basemap/pull/564
10221028
[#563]:

packages/basemap/src/_geoslib.pyx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,30 @@ cdef class BaseGeometry:
307307
b = _get_coords(gout)
308308
p = LineString(b)
309309
pout.append(p)
310+
elif typeid == GEOS_GEOMETRYCOLLECTION:
311+
numgeoms = GEOSGetNumGeometries(g3)
312+
pout = []
313+
for i from 0 <= i < numgeoms:
314+
gout = GEOSGetGeometryN(g3, i)
315+
typeid = GEOSGeomTypeId(gout)
316+
if typeid == GEOS_POLYGON:
317+
b = _get_coords(gout)
318+
p = Polygon(b)
319+
pout.append(p)
320+
elif typeid == GEOS_LINESTRING:
321+
b = _get_coords(gout)
322+
p = LineString(b)
323+
pout.append(p)
324+
else:
325+
# More cases might need to be handled here:
326+
# - GEOS_MULTILINESTRING
327+
# - GEOS_MULTIPOLYGON
328+
# - GEOS_GEOMETRYCOLLECTION
329+
# The underlying problem is the need of a generic
330+
# converter from GEOSGeom pointers to `_geoslib`
331+
# objects, since postprocessing `GeometryCollections`
332+
# might need recursiveness.
333+
pass
310334
else:
311335
#type = PyBytes_FromString(GEOSGeomType(g3))
312336
#raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))

0 commit comments

Comments
 (0)