Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Clipping raster by bounding box with gdal

$
0
0

I've been trying to clip a raster file(.tif) with gdal. But getting Error: "Attempt to create 0x0 dataset is illegal,sizes must be larger than zero". Can anyone tell me what is wrong with the code ?

Edit : Below are my GetGeoTransform() and GetGeoProject() outputs of my tif file, in case it's needed.

PROJCS["WGS 84 / UTM zone 44N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",81],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","32644"]]

from osgeo import gdal, osrfn_input = r'path\File.TIF'fn_extent = 'path/clip_extent.tif'utm11_srs = osr.SpatialReference()utm11_srs.SetWellKnownGeogCS("WGS84")utm11_srs.SetUTM(11,1)bounds_utm = (78.54760607220511, 11.670880584988538, 78.58386873862227, 11.649485363749173)gdal.Warp(fn_extent, fn_input, outputBounds=bounds_utm, outputBoundsSRS=utm11_srs)

Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>