rasterize(allshapes)  return;

"ValueError: No valid geometry objects found for rasterize"

Testung a single shape:

POINT (56.91288 27.33519)


in rasterios github the function checks for following :

geom_type = geom['type']
    if geom_type not in geom_types.union({'GeometryCollection'}):
        return False

cheking for this by hand :

TypeError: 'Geometry' object is not subscriptable

and for :

if 'type' not in geom:
    return False`


cheking by Hand also returnes False

Changing to Polygon wont help

print(shape.geometry()) POLYGON ((....))

print(is_valid_geom(shape.geometry())) False

I dont get this, pls help

  • You need Polygons geometry and not Points – gene Sep 8 at 16:12
  • polygons wont work either – Alexander Vocaet Sep 8 at 19:26
  • Looks like you're trying to pass a gdal/ogr geometry to rasterio? What is the output of type(shape)? If so, this won't work. From the docs "The geometry can either be an object that implements the geo interface or GeoJSON-like object.". Use fiona to read your geometry in. – user2856 Sep 8 at 21:00
  • fiona is not compatible with rasterio , since fiona needs GDAL 2.4 and rasterio needs GDAL 3.1; i haven´t found a wheel for a compatible rasterio – Alexander Vocaet Sep 8 at 21:17
  • opened a new topic for the incompatibility issue gis.stackexchange.com/questions/334301/… – Alexander Vocaet Sep 8 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.