【问题标题】:pgsql2shp - Export several part of tablepgsql2shp - 导出表的几个部分
【发布时间】:2021-01-28 10:09:18
【问题描述】:

在 PostgreSQL(和 PgAdmin)上,我有一个代表某些城市的表和一个包含 3 种模式的列。

name; modalitie; geometrie
name1; modalitie1; geom
name2; modalitie2; geom
name3; modalitie1; geom
name4; modalitie3; geom
name5; modalitie3; geom
.....

我想将此表导出为与名为“modality”的列中的模态一样多的部分(例如:“modality1.sql”、“modality2.sql”等)。有人建议我使用“pgsql2shp”。我设法导出了整个表格,但我无法将它分成几个部分。

pgsql2shp -f path\to\shape -u postgres -h localhost -P "0000" DB "select * from cities"

这样可以吗?

谢谢。

【问题讨论】:

    标签: postgresql cut


    【解决方案1】:

    是的,有可能!

    使用带有 ** WHERE ** 子句的过滤器从表中获取部分数据的相同方式。

    pgsql2shp -f /some/dir/where/you/can/write/output_shapename -h your_host -p 5432 -u aValidUser your_database "SELECT * FROM your_table_name WHERE aColumn='anExistsValue'"
    

    所以,以您的表格为例。

    pgsql2shp -f path\to\shape1 -u postgres -h localhost -P "0000" DB "select * from cities where modalitie='modalitie1'"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 2011-09-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多