Source code for geographer.downloaders.base_downloader_for_single_vector
"""Base class for downloaders for a single vector feature."""from__future__importannotationsimportloggingfromabcimportABC,abstractmethodfrompathlibimportPathfromtypingimportAny,LiteralfrompydanticimportBaseModelfromshapely.geometryimportPolygonlog=logging.getLogger(__name__)
[docs]classRasterDownloaderForSingleVector(ABC,BaseModel):"""Base class for downloaders for a single vector feature."""
[docs]@abstractmethoddefdownload(self,vector_name:str|int,vector_geom:Polygon,download_dir:Path,previously_downloaded_rasters_set:set[str|int],**params:Any,)->dict[Literal["raster_name","raster_processed?"]|str,Any]:"""Download (a series of) raster(s) for a single vector feature. Args: vector_name: Name of vector feature vector_geom: Geometry of vector feature download_dir: Directory in which raw downloads are placed previously_downloaded_rasters_set: Set of (names of) previously downloaded rasters params: Additional keyword arguments. Corresponds to the downloader_params argument of the RasterDownloaderForVectors.download method. Returns: Dict with a key 'list_raster_info_dicts': The corresponding value is a list of dicts containing (at least) the keys 'raster_name', 'raster_processed?', each corresponding to the entries of rasters for the row defined by the raster. """