GeofabrikReader

class pydriosm.reader.GeofabrikReader(data_dir=None, max_tmpfile_size=None)[source]

Read Geofabrik OpenStreetMap data extracts.

Parameters:
  • max_tmpfile_size (int | None) – defaults to None, see also the function pyhelpers.settings.gdal_configurations()

  • data_dir (str | None) – (a path or a name of) a directory where a data file is, defaults to None; when data_dir=None, it refers to a folder named osm_geofabrik under the current working directory

Variables:
  • downloader (GeofabrikDownloader) – instance of the class GeofabrikDownloader

  • name (str) – name of the data resource

  • url (str) – url of the homepage to the Geofabrik free download server

Examples:

>>> from pydriosm.reader import GeofabrikReader
>>> gfr = GeofabrikReader()
>>> gfr.NAME
'Geofabrik'

Attributes

DEFAULT_DATA_DIR

Default download directory.

FILE_FORMATS

Valid file formats.

LONG_NAME

Full name of the data source.

NAME

Name of the data source.

data_dir

Name or pathname of a data directory.

data_paths

Pathnames of all data files.

Methods

cdd(*sub_dir[, mkdir])

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

get_file_path(subregion_name, osm_file_format)

Get the local path to an OSM data file of a geographic (sub)region.

get_pbf_layer_names(subregion_name[, data_dir])

Get indices and names of all layers in the PBF data file of a given (sub)region.

get_shp_pathname(subregion_name[, ...])

Get path(s) to .shp file(s) for a geographic (sub)region (by searching a local data directory).

make_shp_pkl_pathname(shp_zip_filename, ...)

Make a pathname of a pickle file for saving shapefile data.

merge_shp_layers(subregion_names, layer_name)

Merge shapefiles for a specific layer of two or multiple geographic regions.

read_pbf(subregion_name[, data_dir, ...])

Read a PBF (.osm.pbf) data file of a geographic (sub)region.

read_shp(subregion_name[, layer_names, ...])

Read a .shp.zip data file of a geographic (sub)region.

read_var_osm(meth, subregion_name, ...[, ...])

Read data file of various formats (other than PBF and shapefile) for a geographic (sub)region.

remove_extracts(path_to_extract_dir, verbose)

Remove data extracts.

validate_dtype(x)

Validate the data type of the input variable.

validate_file_path(path_to_file[, ...])

Validate the pathname of an OSM data file.

validate_shp_layer_names(layer_names_, ...)

Validate the input of layer name(s) for reading shapefiles.