tilezilla.geoutils module¶
Utilities
-
tilezilla.geoutils.
bounds_to_polygon
(bounds)[source]¶ Returns Shapely polygon of bounds
Parameters: bounds (iterable) – bounds (left bottom right top) Returns: polygon of bounds Return type: shapely.geometry.Polygon
-
tilezilla.geoutils.
intersects_bounds
(a_bounds, b_bounds)[source]¶ Return True/False if a intersects b
Parameters: - a_bounds (iterable) – bounds of a (left bottom right top)
- b_bounds (iterable) – bounds of b (left bottom right top)
Returns: True/False if a intersects b
Return type:
-
tilezilla.geoutils.
match_to_grid
(match, grid, pix_size)[source]¶ Return new postings for input that coalign with grid
Parameters: - match (iterable) – X or Y coordinates of input extent to be repositioned
- grid_xy (iterable) – X or Y coordinates of grid extent to match
- pix_size (iterable) – X or Y pixel sizes of data to match
Returns: new X/Y coordinate of matched input
Return type:
-
tilezilla.geoutils.
meta_to_bounds
(transform, width, height, **kwargs)[source]¶ Convert
rasterio
**dataset.meta to a BoundingBoxParameters: Returns: The box bounding the extent of the raster
Return type:
-
tilezilla.geoutils.
reproject_as_needed
(src, tilespec, resampling='nearest')[source]¶ Return a
rasterio
dataset, reprojected if neededReturns src dataset if reprojection unncessary. Otherwise returns an in memory
rasterio
dataset. Reprojection will snap the bounding coordinates of the source dataset to align with the tile specification.Parameters: Returns: original or reprojected dataset
Return type: rasterio._io.RasterReader
-
tilezilla.geoutils.
reproject_bounds
(bounds, src_crs, dst_crs)[source]¶ Return bounds reprojected to dst_crs
Parameters: - BoundingBox – Bounding box in src_crs
- src_crs (str or dict) – The coordinate reference system, interpretable by rasterio
- dst_crs (str or dict) – The coordinate reference system, interpretable by rasterio
Returns: Bounding box in dst_crs
Return type:
-
tilezilla.geoutils.
snap_transform
(transform, posting)[source]¶ Return a new
Affine
with coordinates coaligned to a postParameters: - transform (affine.Affine) – affine transform to snap
- posting (tuple) – x/y pair of coordinates to snap the transform to
Returns: newly snapped Affine transform
Return type: affine.Affine