perrygeo/python-rasterstats

RuntimeWarning: invalid value encountered in buffer

cascadet opened this issue · 1 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
I am trying to extract the values of points from a raster, both in the same CRS, and it generates the following: "RuntimeWarning: invalid value encountered in buffer". The data looks ok, but I try to de-bug all code with RuntimeWarnings.

To Reproduce
Steps to reproduce the behavior:

  1. How did you install rasterstats and its dependencies? from rasterstats import zonal_stats
  2. What datasets are necessary to reproduce the bug? Please provide links to example data if necessary.
    https://github.com/cascadet/public/tree/main/data
  3. What code is necessary to reproduce the bug? Provide the code directly below or provide links to it.
import os
from rasterstats import zonal_stats
import geopandas as gpd
shps = gpd.read_file('../../public/data/shapes.shp', index = False)
rst_fn = os.path.join('../../public/data/raster.tif')
zonal_stats(vectors = shps, raster = rst_fn, stats= 'mean', geojson_out=True, all_touched = False) 

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.

After further reading, I believe the RuntimeWarning is because I am using an un-projected CRS (EPSG:4269), which shapely does not like. Apologies for flagging it as an issue. Thanks for maintaining an awesome package!