Plot Raster
Plot raster image
- plot_raster : plot single band raster data.
- plot_hist : plot histogram of raster data.
- plot_multibands : plot multi-bands raster data.
- overlay_map : display raster data on interactive map.
Load package
Explore data
BoundingBox(left=100.33732565972996, bottom=13.92514454525035, right=100.9118881154528, top=14.239105737050123)
CRS.from_epsg(4326)
{'driver': 'GTiff', 'dtype': 'uint16', 'nodata': None, 'width': 6396, 'height': 3495, 'count': 4, 'crs': CRS.from_epsg(4326), 'transform': Affine(8.983152841195215e-05, 0.0, 100.33732565972996, 0.0, -8.983152841195215e-05, 14.239105737050123)}
'data/S2_image3.tif'
Plot single band
This tools will read and plot only first band of raster image. Thus, This tools is just suitable for image visualzation.
Plot histogram
Plot Multi-bands
-
bands : sequence of image bands (R,G,B), defualt is [3, 2, 1].
-
brightness : The brightness of image, defualt is 0.85.
from Godream.plotimg import plot_multibands
raster_file = "D:\DGEO\data\S2_image3.tif"
plot_multibands(raster_file, bands =[3,2,1], brightness=0.90)
Export raster
with rasterio.open(r"D:\DGEO\output\output.tif",'w',
driver= ds.driver,
height=ds.height,
width=ds.width,
count=ds.count,
crs=ds.crs,
transform=ds.transform,
dtype=data.dtype
) as dst:
dst.write(data)
Display raster image
This tools can show both raster and vector data on Interactive Map.
The CRS of this tools is EPSG:4326.