PostGIS 在哪里存储加载的 shp2pgsql 数据?
Where does PostGIS store data loaded shp2pgsql?
当我安装 PostGIS 及其 address_standardizer
和 postgis_tiger_geocoder
扩展时,会创建许多表格,我可以使用 \dt
查看这些表格。这些表的作用是什么?shp2pgsql
在哪里加载 shapefile?
为了展示这个,一个空的数据库,首先有什么数据库?什么都没有,用 \dt
.
检查
testgis=# -- Enable PostGIS (as of 3.0 contains just geometry/geography)
CREATE EXTENSION postgis;
-- enable raster support (for 3+)
CREATE EXTENSION postgis_raster;
-- Enable Topology
CREATE EXTENSION postgis_topology;
-- Enable PostGIS Advanced 3D
-- and other geoprocessing algorithms
-- sfcgal not available with all distributions
CREATE EXTENSION postgis_sfcgal;
-- fuzzy matching needed for Tiger
CREATE EXTENSION fuzzystrmatch;
-- rule based standardizer
CREATE EXTENSION address_standardizer;
-- example rule data set
CREATE EXTENSION address_standardizer_data_us;
-- Enable US Tiger Geocoder
CREATE EXTENSION postgis_tiger_geocoder;
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
ERROR: can not open the control file of extension «/usr/share/postgresql-13/extension/postgis_sfcgal.control»: File does not exist
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
现在检查\dt
。
拥有 postgres 用户:
List of relations
Schema | Name | Type | Owner
--------+--------------------------+-------+----------
public | spatial_ref_sys | table | postgres
public | us_gaz | table | postgres
public | us_lex | table | postgres
public | us_rules | table | postgres
tiger | addr | table | postgres
tiger | addrfeat | table | postgres
tiger | bg | table | postgres
tiger | county | table | postgres
tiger | county_lookup | table | postgres
tiger | countysub_lookup | table | postgres
tiger | cousub | table | postgres
tiger | direction_lookup | table | postgres
tiger | edges | table | postgres
tiger | faces | table | postgres
tiger | featnames | table | postgres
tiger | geocode_settings | table | postgres
tiger | geocode_settings_default | table | postgres
tiger | loader_lookuptables | table | postgres
tiger | loader_platform | table | postgres
tiger | loader_variables | table | postgres
tiger | pagc_gaz | table | postgres
tiger | pagc_lex | table | postgres
tiger | pagc_rules | table | postgres
tiger | place | table | postgres
tiger | place_lookup | table | postgres
tiger | secondary_unit_lookup | table | postgres
tiger | state | table | postgres
tiger | state_lookup | table | postgres
tiger | street_type_lookup | table | postgres
tiger | tabblock | table | postgres
tiger | tract | table | postgres
tiger | zcta5 | table | postgres
tiger | zip_lookup | table | postgres
tiger | zip_lookup_all | table | postgres
tiger | zip_lookup_base | table | postgres
tiger | zip_state | table | postgres
tiger | zip_state_loc | table | postgres
(37 rows)
普通用户:
Listado de relaciones
Esquema | Nombre | Tipo | Dueño
---------+-----------------+-------+----------
public | spatial_ref_sys | tabla | postgres
public | us_gaz | tabla | postgres
public | us_lex | tabla | postgres
public | us_rules | tabla | postgres
(4 filas)
shp2pgsql
默认情况下会为每个导入的 shapefile 创建一个 table。但是,您可以使用 -a
选项让它将多个 shapefile 加载到同一个 table 中。
tablespatial_ref_sys
,顾名思义,只保留空间参考系统的数据,这对于坐标转换等操作至关重要。
tables us_gaz
、us_lex
和 us_rules
与扩展名 address_standardizer
.
相关
架构 tiger
中的其他 table 与扩展 postgis_tiger_geocoder
相关 - 也是系统 table 不应该真正担心的。
当我安装 PostGIS 及其 address_standardizer
和 postgis_tiger_geocoder
扩展时,会创建许多表格,我可以使用 \dt
查看这些表格。这些表的作用是什么?shp2pgsql
在哪里加载 shapefile?
为了展示这个,一个空的数据库,首先有什么数据库?什么都没有,用 \dt
.
testgis=# -- Enable PostGIS (as of 3.0 contains just geometry/geography)
CREATE EXTENSION postgis;
-- enable raster support (for 3+)
CREATE EXTENSION postgis_raster;
-- Enable Topology
CREATE EXTENSION postgis_topology;
-- Enable PostGIS Advanced 3D
-- and other geoprocessing algorithms
-- sfcgal not available with all distributions
CREATE EXTENSION postgis_sfcgal;
-- fuzzy matching needed for Tiger
CREATE EXTENSION fuzzystrmatch;
-- rule based standardizer
CREATE EXTENSION address_standardizer;
-- example rule data set
CREATE EXTENSION address_standardizer_data_us;
-- Enable US Tiger Geocoder
CREATE EXTENSION postgis_tiger_geocoder;
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
ERROR: can not open the control file of extension «/usr/share/postgresql-13/extension/postgis_sfcgal.control»: File does not exist
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
现在检查\dt
。
拥有 postgres 用户:
List of relations
Schema | Name | Type | Owner
--------+--------------------------+-------+----------
public | spatial_ref_sys | table | postgres
public | us_gaz | table | postgres
public | us_lex | table | postgres
public | us_rules | table | postgres
tiger | addr | table | postgres
tiger | addrfeat | table | postgres
tiger | bg | table | postgres
tiger | county | table | postgres
tiger | county_lookup | table | postgres
tiger | countysub_lookup | table | postgres
tiger | cousub | table | postgres
tiger | direction_lookup | table | postgres
tiger | edges | table | postgres
tiger | faces | table | postgres
tiger | featnames | table | postgres
tiger | geocode_settings | table | postgres
tiger | geocode_settings_default | table | postgres
tiger | loader_lookuptables | table | postgres
tiger | loader_platform | table | postgres
tiger | loader_variables | table | postgres
tiger | pagc_gaz | table | postgres
tiger | pagc_lex | table | postgres
tiger | pagc_rules | table | postgres
tiger | place | table | postgres
tiger | place_lookup | table | postgres
tiger | secondary_unit_lookup | table | postgres
tiger | state | table | postgres
tiger | state_lookup | table | postgres
tiger | street_type_lookup | table | postgres
tiger | tabblock | table | postgres
tiger | tract | table | postgres
tiger | zcta5 | table | postgres
tiger | zip_lookup | table | postgres
tiger | zip_lookup_all | table | postgres
tiger | zip_lookup_base | table | postgres
tiger | zip_state | table | postgres
tiger | zip_state_loc | table | postgres
(37 rows)
普通用户:
Listado de relaciones
Esquema | Nombre | Tipo | Dueño
---------+-----------------+-------+----------
public | spatial_ref_sys | tabla | postgres
public | us_gaz | tabla | postgres
public | us_lex | tabla | postgres
public | us_rules | tabla | postgres
(4 filas)
shp2pgsql
默认情况下会为每个导入的 shapefile 创建一个 table。但是,您可以使用 -a
选项让它将多个 shapefile 加载到同一个 table 中。
tablespatial_ref_sys
,顾名思义,只保留空间参考系统的数据,这对于坐标转换等操作至关重要。
tables us_gaz
、us_lex
和 us_rules
与扩展名 address_standardizer
.
架构 tiger
中的其他 table 与扩展 postgis_tiger_geocoder
相关 - 也是系统 table 不应该真正担心的。