Tile Extraction
Get processing AOIs for a SAR scene. |
|
Extract one or multiple MGRS tiles from the global Sentinel-2 tiling grid and return it as a |
|
Convert the HTML description field of the MGRS tile KML file to a dictionary. |
|
Convert a MultiPolygon WKT with one Polygon to a simple Polygon WKT. |
|
Return a list of MGRS tile IDs or vector objects overlapping one or multiple areas of interest. |
|
Convert a WKT geometry to a |
- cesard.tile_extraction.aoi_from_scene(scene, multi=True, percent=1)[source]
Get processing AOIs for a SAR scene. The MGRS grid requires a SAR scene to be geocoded to multiple UTM zones depending on the overlapping MGRS tiles and their projection. This function returns the following for each UTM zone group:
the extent in WGS84 coordinates (key extent)
the extent in UTM coordinates (key extent_utm)
the EPSG code of the UTM zone (key epsg)
A minimum overlap of the AOIs with the SAR scene is ensured by buffering the AOIs if necessary. The minimum overlap can be controlled with parameter percent.
- Parameters:
scene (
ID) – the SAR scene objectmulti (
bool) – split into multiple AOIs per overlapping UTM zone or just one AOI covering the whole scene. In the latter case the best matching UTM zone is auto-detected (using functionspatialist.auxil.utm_autodetect()).percent (
int|float) – the minimum overlap in percent of each AOI with the SAR scene. See functioncesard.ancillary.buffer_min_overlap().
- Return type:
- Returns:
a list of dictionaries with keys extent, extent_utm, epsg
- cesard.tile_extraction.aoi_from_tile(tile)[source]
Extract one or multiple MGRS tiles from the global Sentinel-2 tiling grid and return it as a
Vectorobject.- Parameters:
tile (
str|list[str]) – The MGRS tile ID(s) that should be extracted and returned as a vector object. Can also be expressed as <tile ID>_<EPSG code> (e.g. 33TUN_32632). In this case the geometry of the tile is reprojected to the target EPSG code, its corner coordinates rounded to multiples of 10, and a newVectorobject created.- Return type:
- Returns:
either a single object or a list depending on tile
- cesard.tile_extraction.description2dict(description)[source]
Convert the HTML description field of the MGRS tile KML file to a dictionary.
- cesard.tile_extraction.multipolygon2polygon(wkt)[source]
Convert a MultiPolygon WKT with one Polygon to a simple Polygon WKT. The Sentinel-2 KML grid file stores all geometries as MultiPolygons. This function simply converts the geometries to simple Polygons. Not all geometries in the KML file have been checked. In case there are ever multiple Polygons in one MultiPolygon, an RuntimeError is raised. All other geometries are returned as is.
- cesard.tile_extraction.tile_from_aoi(vector, epsg=None, strict=True, return_geometries=False, tilenames=None)[source]
Return a list of MGRS tile IDs or vector objects overlapping one or multiple areas of interest.
- Parameters:
vector (
Vector|list[Vector]) – The vector object(s) to read. CRS must be EPSG:4236.epsg (
int|list[int] |None) – Define which EPSG code(s) are allowed for the tile selection. If None, all tile IDs are returned regardless of projection.strict (
bool) – Strictly only return the names/geometries of the overlapping tiles in the target projection or also allow reprojection of neighbouring tiles? In the latter case a tile name takes the form <tile ID>_<EPSG code>, e.g. 33TUN_32632. Only applies if argument epsg is of type int or a list with one element.return_geometries (
bool) – return a list ofspatialist.vector.Vectorgeometry objects (or just the tile names)?tilenames (
list[str] |None) – an optional list of MGRS tile names to limit the selection
- Return type:
- Returns:
A list of unique MGRS tile IDs or
spatialist.vector.Vectorobjects with an attribute mgrs containing the tile ID.
- cesard.tile_extraction.wkt2vector_regrid(wkt, epsg_in, epsg_out=None)[source]
Convert a WKT geometry to a
spatialist.vector.Vectorobject and optionally reproject and regrid it.- Parameters:
- Return type:
- Returns:
the geometry object
See also