nicholas-ys-tan / geoplot

High-level geospatial data visualization library for Python.
https://residentmario.github.io/geoplot/index.html
MIT License
0 stars 0 forks source link

BUG: example plot_los_angeles_flights not working #5

Closed nicholas-ys-tan closed 4 months ago

nicholas-ys-tan commented 4 months ago

Error message:

_______________________________________________________________________________________________ ERROR collecting examples/plot_los_angeles_flights.py _______________________________________________________________________________________________
examples/plot_los_angeles_flights.py:27: in <module>
    ax = gplt.sankey(
geoplot/geoplot.py:1477: in sankey
    return plot.draw()
geoplot/geoplot.py:1433: in draw
    path_geoms = self.df.geometry.map(parse_geom)
../../../miniconda3/envs/geoplot-dev/lib/python3.12/site-packages/pandas/core/series.py:4700: in map
    new_values = self._map_values(arg, na_action=na_action)
../../../miniconda3/envs/geoplot-dev/lib/python3.12/site-packages/pandas/core/base.py:919: in _map_values
    return arr.map(mapper, na_action=na_action)
../../../miniconda3/envs/geoplot-dev/lib/python3.12/site-packages/pandas/core/arrays/base.py:2322: in map
    return map_array(self, mapper, na_action=na_action)
../../../miniconda3/envs/geoplot-dev/lib/python3.12/site-packages/pandas/core/algorithms.py:1743: in map_array
    return lib.map_infer(values, mapper, convert=convert)
lib.pyx:2972: in pandas._libs.lib.map_infer
    ???
geoplot/geoplot.py:1427: in parse_geom
    return shapely.geometry.LineString(geom)
../../../miniconda3/envs/geoplot-dev/lib/python3.12/site-packages/shapely/geometry/linestring.py:66: in __new__
    coordinates = [_coords(o) for o in coordinates]
E   TypeError: 'MultiPoint' object is not iterable
nicholas-ys-tan commented 4 months ago

From shapely 2.0 release notes:

Multi-part geometries such as MultiPolygon no longer behave as “sequences”. This means that they no longer have a length, are not iterable, and are not indexable anymore. Use the .geoms attribute instead to access individual parts of a multi-part geometry.

Second issue: GeoAxes.outline_patch was deprecated in this PR: https://github.com/SciTools/cartopy/pull/1213

can be fixed by: GeoAxes.spines['geo']