-
Notifications
You must be signed in to change notification settings - Fork 534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rasterize produces holes for lists of GeometryCollection #1253
Comments
Okay, I think the only way this is not an upstream issue (in GDAL) is if there is a bug in Rasterio's OGR geometry factory specific to geometry collections. I'll take a look, but probably not until after 1.0, because we can document a work around for this in the short term. @Juanlu001 would you be willing to see if updating GDAL to 2.2 fixes this? Lastly, I'd like to point out that mixing conda packages, conda-forge packages, and the binary wheels I publish to PyPI is a perilous thing to do. My binary wheels are not compatible with conda. In general, I think C extension modules on PyPI can't be installed into a conda environment using pip. |
I get the same behavior with GDAL 2.2. Just to make sure it's not a result of mixing binaries as you say, I installed rasterio from source to compile it against my libgdal:
And nothing changes.
I know... "don't do this at home" :)
I do it all the time in Linux, and so far I have not found problems. Would you please point me to some past issue that was due to this? |
@Juanlu001 I checked in an x-failing test for this in the I was able to isolate this from Shapely and reproduce the issue using GeoJSON dict objects. It turns out that when we are iterating over a Shapely GeometryCollection object, it is equivalent to a list of the underlying features. This explains why these are identical:
I was able to reproduce the hole in the middle of the overlapping polygons in the geometry collection directly using To get around this, we could probably iterate over the contained geometries when we detect a geometry collection object (effectively same outcome as your |
Thank you! 😊 |
Expected behavior and actual behavior.
I expected
rasterize(GeometryCollection([shp1, shp2]))
to produce the same result thanrasterize([GeometryCollection([shp1, shp2])])
. Instead, the latter produces a hole in the overlap, regardless of the direction of the exterior of the two polygons.Steps to reproduce the problem.
Operating system
Linux Mint 18.3
Rasterio version and provenance
The text was updated successfully, but these errors were encountered: