public static IEnvelope GetExtents([NotNull] Dataset dataset) { if (dataset == null) { return(null); } var geoTrans = new double[6]; dataset.GetGeoTransform(geoTrans); var err = (CPLErr)Gdal.GetLastErrorType(); if (CPLErr.CE_None != err) { throw new ApplicationException("GetGeoTransform() failed."); } var regularGridGeoTransform = new RegularGridGeoTransform(geoTrans); return(GeometryFactory.CreateEnvelope(regularGridGeoTransform.Left, regularGridGeoTransform.Left + (regularGridGeoTransform.HorizontalPixelResolution * dataset.RasterXSize), regularGridGeoTransform.Top - (regularGridGeoTransform.VerticalPixelResolution * dataset.RasterYSize), regularGridGeoTransform.Top)); }