New answers tagged

2

As with what @user30184 said, the issue is with the 4th NIR band been read as the mask band. After only extracting 3 band then writing it out, the PNG shows the correct picture.


1

eventually this worked for me: dataset = rasterio.open(input_file_path, 'r') bands = [1, 2, 3] data = dataset.read(bands) transform = rasterio.transform.from_bounds(west, south, east, north, data.shape[1], data.shape[2]) crs = {'init': 'epsg:3006'} with rasterio.open(output_file_path, 'w', driver='GTiff', width=data.shape[1], height=data....


2

Check out gdalwarp that is part of the GDAL library. There are Python bindings available through the osgeo package. This is untested, but it should get you close to what you need: from osgeo import gdal gdal.Warp( dstDS, srcDS, format='GTiff', dstSRS='EPSG:3006', outputBounds=[minX, minY, maxX, maxY] ) You'll need to define the source and ...


Top 50 recent answers are included