perrygeo / python-rasterstats

Summary statistics of geospatial raster datasets based on vector geometries.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ShapelyDeprecationWarning: 'type' attribute to 'geom_type' attribute

marianobonelli opened this issue · comments

Welcome to the python-rasterstats issue tracker. Thanks for putting together a bug report! By following the template below, we'll be better able to reproduce the problem on our end.

If you don't have a bug specifically but a general support question, please visit https://gis.stackexchange.com/

Describe the bug

/usr/local/lib/python3.8/dist-packages/rasterstats/main.py:156: ShapelyDeprecationWarning:
The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.

The warning that appears in the provided code refers to a change in the way that Shapely, a geometry processing library, handles the 'type' attribute of geometries. Instead of using the 'type' attribute, it is recommended to use the 'geom_type' attribute. To fix this warning, the code can be modified to use the 'geom_type' attribute instead of the 'type' attribute when necessary.

To Reproduce
Steps to reproduce the behavior:

  1. How did you install rasterstats and its dependencies?
  2. What datasets are necessary to reproduce the bug? Please provide links to example data if necessary.
  3. What code is necessary to reproduce the bug? Provide the code directly below or provide links to it.
# Code to reproduce the error
zonal_stats = rasterstats.zonal_stats(
    output_geojson, vi_array, 
    affine=affine, nodata=nodata,
    stats="min max mean ",
    geojson_out=True,
) 

Feature Requests

python-rasterstats is not currently accepting any feature requests via the issue tracker. If you'd like to add a backwards-compatible feature, please open a pull request - it doesn't need to be 100% ready but should include a working proof-of-concept, tests, and should not break the existing API.

resolved in #266