PostgresOSM.get_subregion_table_column_info¶
-
PostgresOSM.
get_subregion_table_column_info
(subregion_name, layer_name, as_dict=False, table_named_as_subregion=False, schema_named_as_layer=False)¶ Get information about columns of a specific schema and table data of a geographic region.
- Parameters
subregion_name (str) – name of a geographic region, which acts as a table name
layer_name (str) – name of an OSM layer (e.g. ‘points’, ‘railways’, …), which acts as a schema name
as_dict (bool) – whether to return the column information as a dictionary, defaults to
True
table_named_as_subregion (bool) – whether to use subregion name as table name, defaults to
False
schema_named_as_layer (bool) – whether a schema is named as a layer name, defaults to
False
- Returns
information about each column of the given table
- Return type
pandas.DataFrame or dict
Examples:
>>> from pydriosm.ios import PostgresOSM >>> osmdb_test = PostgresOSM(database_name='osmdb_test') Password (postgres@localhost:5432): *** Connecting postgres:***@localhost:5432/osmdb_test ... Successfully. >>> region_name = 'London' >>> lyr_name = 'points' >>> # Take for example a table named "points"."London" >>> tbl_col_info = osmdb_test.get_subregion_table_column_info(region_name, lyr_name) >>> type(tbl_col_info) pandas.core.frame.DataFrame >>> tbl_col_info.index.to_list()[:5] ['table_catalog', 'table_schema', 'table_name', 'column_name', 'ordinal_position'] >>> # Another example of a table named "points"."Greater London" >>> tbl_col_info_dict = osmdb_test.get_subregion_table_column_info( ... region_name, lyr_name, as_dict=True, table_named_as_subregion=True, ... schema_named_as_layer=True) >>> type(tbl_col_info_dict) dict >>> list(tbl_col_info_dict.keys())[:5] ['table_catalog', 'table_schema', 'table_name', 'column_name', 'ordinal_position']