zensvi.download.KVDownloader¶
- class zensvi.download.KVDownloader(log_path=None, max_workers=None, verbosity=1)¶
Bases:
zensvi.download.base.BaseDownloader
KartaView Downloader class.
- Parameters:
log_path (str, optional) – Path to the log file. Defaults to None.
max_workers (int, optional) – Number of workers for parallel processing. Defaults to None.
verbosity (int, optional) – Level of verbosity for progress bars. Defaults to 1. 0 = no progress bars, 1 = outer loops only, 2 = all loops.
- property max_workers¶
Property for the number of workers for parallel processing.
- Returns:
max_workers
- Return type:
int
- property verbosity¶
Property for the verbosity level of progress bars.
- Returns:
verbosity level
- Return type:
int
- download_svi(dir_output, path_pid=None, lat=None, lon=None, input_csv_file='', input_shp_file='', input_place_name='', buffer=10, update_pids=False, cropped=False, batch_size=1000, start_date=None, end_date=None, metadata_only=False, max_workers=None)¶
Downloads street view images from KartaView using specified parameters.
- Parameters:
dir_output (str) – Directory where output files and images will be stored.
path_pid (str, optional) – Path to a file containing panorama IDs. If not provided, IDs will be fetched based on other parameters.
lat (float, optional) – Latitude to fetch panorama IDs around this point. Must be used with lon.
lon (float, optional) – Longitude to fetch panorama IDs around this point. Must be used with lat.
input_csv_file (str, optional) – Path to a CSV file containing locations for which to fetch panorama IDs.
input_shp_file (str, optional) – Path to a shapefile containing geographic locations for fetching panorama IDs.
input_place_name (str, optional) – A place name for geocoding to fetch panorama IDs.
buffer (int, optional) – Buffer size in meters to expand the geographic area for panorama ID fetching.
update_pids (bool, optional) – If True, will update panorama IDs even if a valid path_pid is provided. Defaults to False.
cropped (bool, optional) – If True, images will be cropped to the upper half. Defaults to False.
batch_size (int, optional) – Number of images to process in each batch. Defaults to 1000.
start_date (str, optional) – Start date (YYYY-MM-DD) to filter images by capture date.
end_date (str, optional) – End date (YYYY-MM-DD) to filter images by capture date.
metadata_only (bool, optional) – If True, skips downloading images and only fetches metadata. Defaults to False.
max_workers (int, optional) – Number of workers for parallel processing. If None, it will be set to min(32, os.cpu_count() + 4).
- Returns:
This method does not return a value but will save files directly to the specified output directory.
- Return type:
None
- Raises:
ValueError – If required parameters for fetching panorama IDs are not adequately specified.
FileNotFoundError – If path_pid is specified but the file does not exist.
Notes
This method logs significant events and errors, making it suitable for both interactive usage and automated workflows.
- property log_path¶
Property for log_path.
- Returns:
Path to the log file
- Return type:
str