PostgresOSM¶
-
class
pydriosm.ios.
PostgresOSM
(host='localhost', port=5432, username='postgres', password=None, database_name='postgres', confirm_new_db=False, data_source='Geofabrik', verbose=True)[source]¶ A class representation of a tool for I/O and storage of OSM data extracts with PostgreSQL.
- Parameters
host (str or None) – host address, defaults to
'localhost'
(or'127.0.0.1'
)port (int, None) – port, defaults to
5432
username (str or None) – database username, defaults to
'postgres'
password (str or int or None) – database password, defaults to
None
database_name (str) – database name, defaults to
'postgres'
confirm_new_db (bool) – whether to impose a confirmation to create a new database, defaults to
False
data_source (str) – source of data extracts, including
'Geofabrik'
and'BBBike'
, defaults to'Geofabrik'
verbose (bool) – whether to print relevant information in console as the function runs, defaults to
True
Example:
>>> from pydriosm.ios import PostgresOSM >>> database_name = 'osmdb_test' >>> osmdb_test = PostgresOSM(database_name=database_name) Password (postgres@localhost:5432): *** Connecting postgres:***@localhost:5432/osmdb_test ... Successfully. >>> print(osmdb_test.DataSource) Geofabrik >>> print(osmdb_test.Downloader) <pydriosm.downloader.GeofabrikDownloader object at ...> >>> # Change the data source: >>> osmdb_test.DataSource = 'BBBike' >>> print(osmdb_test.Downloader) <pydriosm.downloader.BBBikeDownloader object at ...>
Methods
drop_subregion_table
(subregion_table_names)Delete all or specific schemas/layers of subregion data from the database being connected.
fetch_osm_data
(subregion_name[, …])Fetch OSM data (of one or multiple layers) of a geographic region.
get_subregion_table_column_info
(…[, …])Get information about columns of a specific schema and table data of a geographic region.
get_table_name_for_subregion
(subregion_name)Get the default table name for a specific geographic region.
import_osm_data
(osm_data, table_name[, …])Import OSM data into a database.
import_osm_layer
(osm_layer_data, table_name, …)Import one layer of OSM data into a table.
import_subregion_osm_pbf
(subregion_names[, …])Import data of geographic region(s) that do not have (sub-)subregions into a database.
subregion_table_exists
(subregion_name, …)Check if a table (for a geographic region) exists.
Attributes
An instance of either
GeofabrikDownloader
orBBBikeDownloader
depending on the specifieddata_source
for creating aPostgresOSM
instance.Name of the current
PostgresOSM.Downloader
.An instance of either
GeofabrikReader
orBBBikeReader
depending on the specifieddata_source
for creating aPostgresOSM
instance.Homepage URL of data resource for current
PostgresOSM.Downloader
.