BBBikeDownloader

class pydriosm.downloader.BBBikeDownloader(download_dir=None, update=False, **kwargs)[source]

Download OSM data from BBBike free download server.

Parameters:

download_dir (str | None) – (a path or a name of) a directory for saving downloaded data files; if download_dir=None (default), the downloaded data files are saved into a folder named 'osm_data' under the current working directory

Variables:
  • valid_subregion_names (set) – names of (sub)regions available on BBBike free download server

  • valid_file_formats (set) – filename extensions of the data files available on BBBike free download server

  • subregion_index (pandas.DataFrame) – index of download pages for all available (sub)regions

  • catalogue (pandas.DataFrame) – a catalogue (index) of all available BBBike downloads

  • download_dir (str | None) – name or pathname of a directory for saving downloaded data files (in accordance with the parameter download_dir)

  • data_pathnames (list) – list of pathnames of all downloaded data files

Examples:

>>> from pydriosm.downloader import BBBikeDownloader
>>> import os
>>> bbd = BBBikeDownloader()
>>> bbd.NAME
'BBBike'
>>> bbd.LONG_NAME
'BBBike exports of OpenStreetMap data'
>>> bbd.URL
'https://download.bbbike.org/osm/bbbike/'
>>> os.path.relpath(bbd.download_dir)
'osm_data\bbbike'
>>> bbd = BBBikeDownloader(download_dir="tests\osm_data")
>>> os.path.relpath(bbd.download_dir)
'tests\osm_data'

Attributes

DEFAULT_DOWNLOAD_DIR

Default download directory.

FILE_FORMATS

Valid file formats.

LONG_NAME

Full name of the data resource.

NAME

Name of the free downloader server.

URL

URL of the homepage to the free download server.

Methods

cdd(*sub_dir[, mkdir])

Change directory to default download directory and its subdirectories or a specific file.

download_data(subregion_names, osm_file_formats)

Download OSM data (of a specific file format) of one (or multiple) geographic (sub)region(s).

file_exists(subregion_name, osm_file_format)

Check if a requested data file of a geographic (sub)region already exists locally, given its default filename.

file_exists_and_more(subregion_names, ...[, ...])

Check if a requested data file already exists and compile information for downloading the data.

format_confirmation_prompt([data_name, ...])

Compose a short message to be printed for confirmation.

get_bbbike_cities([update, ...])

Get the names of all the available cities.

get_bbbike_cities_poly([update, ...])

Get location information of all cities available on the download server.

get_catalogue([update, ...])

Get a dict-type index of available formats, data types and a download catalogue.

get_default_sub_path(subregion_name_, ...)

Get default sub path for saving OSM data file of a geographic (sub)region.

get_prepacked_data(meth[, data_name, ...])

Get auxiliary data (that is to be prepacked in the package).

get_sub_catalogue(subregion_name[, update, ...])

Get a download catalogue of OSM data available for a given geographic (sub)region.

get_subregion_download_url(subregion_name, ...)

Get a valid URL for downloading OSM data of a specific file format for a geographic (sub)region.

get_subregion_index([update, ...])

Get a catalogue for geographic (sub)regions.

get_valid_download_info(subregion_name, ...)

Get information of downloading (or downloaded) data file.

get_valid_subregion_names([update, ...])

Get a list of names of all geographic (sub)regions.

make_subregion_dirname(subregion_name_)

Make the name of the directory one level up from an OSM data file of a geographic (sub)region.

print_action_prompt([data_name, verbose, ...])

Print a short message showing the action as a function runs.

print_status([data_name, path_to_file, ...])

Print a short message for an otherwise situation.

validate_file_format(osm_file_format[, ...])

Validate an input file format of OSM data.

validate_subregion_name(subregion_name[, ...])

Validate an input name of a geographic (sub)region.

verify_download_dir([download_dir, ...])

Verify the pathname of the current download directory.