rio_tiler.reader
rio_tiler.reader ¶
rio-tiler.reader: low level reader.
_apply_buffer ¶
Apply buffer on bounds.
_get_width_height ¶
Get Output Width/Height based on a max_size and dataset shape.
part ¶
part(src_dst: Union[DatasetReader, DatasetWriter, WarpedVRT], bounds: BBox, height: Optional[int] = None, width: Optional[int] = None, max_size: Optional[int] = None, dst_crs: Optional[CRS] = None, bounds_crs: Optional[CRS] = None, indexes: Optional[Indexes] = None, minimum_overlap: Optional[float] = None, padding: Optional[int] = None, buffer: Optional[float] = None, force_binary_mask: bool = True, nodata: Optional[NoData] = None, vrt_options: Optional[Dict] = None, align_bounds_with_dataset: bool = False, resampling_method: RIOResampling = 'nearest', reproject_method: WarpResampling = 'nearest', unscale: bool = False, post_process: Optional[Callable[[MaskedArray], MaskedArray]] = None) -> ImageData
Read part of a dataset.
Parameters:
-
src_dst
(DatasetReader or DatasetWriter or WarpedVRT
) –Rasterio dataset.
-
bounds
(tuple
) –Output bounds (left, bottom, right, top). By default the coordinates are considered to be in either the dataset CRS or in the
dst_crs
if set. Usebounds_crs
to set a specific CRS. -
height
(int
, default:None
) –Output height of the image.
-
width
(int
, default:None
) –Output width of the image.
-
max_size
(int
, default:None
) –Limit output size image if not width and height.
-
dst_crs
(CRS
, default:None
) –Target coordinate reference system.
-
bounds_crs
(CRS
, default:None
) –Overwrite bounds Coordinate Reference System.
-
indexes
(sequence of int or int
, default:None
) –Band indexes.
-
minimum_overlap
(float
, default:None
) –Minimum % overlap for which to raise an error with dataset not covering enough of the tile.
-
padding
(int
, default:None
) –Padding to apply to each bbox edge. Helps reduce resampling artefacts along edges. Defaults to
0
. -
buffer
(float
, default:None
) –Buffer to apply to each bbox edge. Defaults to
0.
. -
nodata
(int or float
, default:None
) –Overwrite dataset internal nodata value.
-
vrt_options
(dict
, default:None
) –Options to be passed to the rasterio.warp.WarpedVRT class.
-
align_bounds_with_dataset
(bool
, default:False
) –Align input bounds with dataset transform. Defaults to
False
. -
resampling_method
(RIOResampling
, default:'nearest'
) –RasterIO resampling algorithm. Defaults to
nearest
. -
reproject_method
(WarpResampling
, default:'nearest'
) –WarpKernel resampling algorithm. Defaults to
nearest
. -
unscale
(bool
, default:False
) –Apply 'scales' and 'offsets' on output data value. Defaults to
False
. -
post_process
(callable
, default:None
) –Function to apply on output data and mask values.
Returns:
-
ImageData
–ImageData
point ¶
point(src_dst: Union[DatasetReader, DatasetWriter, WarpedVRT], coordinates: Tuple[float, float], indexes: Optional[Indexes] = None, coord_crs: CRS = WGS84_CRS, force_binary_mask: bool = True, nodata: Optional[NoData] = None, vrt_options: Optional[Dict] = None, resampling_method: RIOResampling = 'nearest', reproject_method: WarpResampling = 'nearest', unscale: bool = False, post_process: Optional[Callable[[MaskedArray], MaskedArray]] = None) -> PointData
Read a pixel value for a point.
Parameters:
-
src_dst
(DatasetReader or DatasetWriter or WarpedVRT
) –Rasterio dataset.
-
coordinates
(tuple
) –Coordinates in form of (X, Y).
-
indexes
(sequence of int or int
, default:None
) –Band indexes.
-
coord_crs
(CRS
, default:WGS84_CRS
) –Coordinate Reference System of the input coords. Defaults to
epsg:4326
. -
nodata
(int or float
, default:None
) –Overwrite dataset internal nodata value.
-
vrt_options
(dict
, default:None
) –Options to be passed to the rasterio.warp.WarpedVRT class.
-
resampling_method
(RIOResampling
, default:'nearest'
) –RasterIO resampling algorithm. Defaults to
nearest
. -
reproject_method
(WarpResampling
, default:'nearest'
) –WarpKernel resampling algorithm. Defaults to
nearest
. -
unscale
(bool
, default:False
) –Apply 'scales' and 'offsets' on output data value. Defaults to
False
. -
post_process
(callable
, default:None
) –Function to apply on output data and mask values.
Returns:
-
PointData
–PointData
read ¶
read(src_dst: Union[DatasetReader, DatasetWriter, WarpedVRT], dst_crs: Optional[CRS] = None, height: Optional[int] = None, width: Optional[int] = None, max_size: Optional[int] = None, indexes: Optional[Indexes] = None, window: Optional[Window] = None, force_binary_mask: bool = True, nodata: Optional[NoData] = None, vrt_options: Optional[Dict] = None, resampling_method: RIOResampling = 'nearest', reproject_method: WarpResampling = 'nearest', unscale: bool = False, post_process: Optional[Callable[[MaskedArray], MaskedArray]] = None) -> ImageData
Low level read function.
Parameters:
-
src_dst
(DatasetReader or DatasetWriter or WarpedVRT
) –Rasterio dataset.
-
dst_crs
(CRS
, default:None
) –Target coordinate reference system.
-
height
(int
, default:None
) –Output height of the image.
-
width
(int
, default:None
) –Output width of the image.
-
max_size
(int
, default:None
) –Limit output size image if not width and height.
-
indexes
(sequence of int or int
, default:None
) –Band indexes.
-
window
(Window
, default:None
) –Window to read.
-
nodata
(int or float
, default:None
) –Overwrite dataset internal nodata value.
-
vrt_options
(dict
, default:None
) –Options to be passed to the rasterio.warp.WarpedVRT class.
-
resampling_method
(RIOResampling
, default:'nearest'
) –RasterIO resampling algorithm. Defaults to
nearest
. -
reproject_method
(WarpResampling
, default:'nearest'
) –WarpKernel resampling algorithm. Defaults to
nearest
. -
force_binary_mask
(bool
, default:True
) –Cast returned mask to binary values (0 or 255). Defaults to
True
. -
unscale
(bool
, default:False
) –Apply 'scales' and 'offsets' on output data value. Defaults to
False
. -
post_process
(callable
, default:None
) –Function to apply on output data and mask values.
Returns:
-
ImageData
–ImageData