1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Clipping Raster through a shapefile using Python

Discussão em 'Python' iniciado por Stack, Fevereiro 4, 2025.

  1. Stack

    Stack Membro Participativo

    I've been trying to clip a raster file with a corresponding shape file using gdal Warp. However, I am encountering an error as follows:

    <osgeo.gdal.Dataset; proxy of <Swig Object of type 'GDALDatasetShadow *' at 0x7f30542b86c0> >

    from osgeo import gdal

    rasin = "location of raster file.tif"
    output = "destination of clipped raster file.tif"
    shpin = "location of shapefile.shp"

    gdal.Warp(output, rasin, cutlineDSName = shpin, format="GTiff", cropToCutline = True)

    Continue reading...

Compartilhe esta Página