【问题标题】:Importing shapefiles in postgresql in linux using pgadmin 4使用 pgadmin 4 在 Linux 中的 postgresql 中导入 shapefile
【发布时间】:2020-05-19 00:54:36
【问题描述】:

我是 postGIS 新手,我关注的是 this 教程。

我无法通过安装部分,因为说明已过时。

当它说return to the Dashboard, and click on the Import shapefiles link in the PostGIS section.时我卡住了

我正在使用 pgadmin 4,但我无法在那里找到 postGIS 部分。

【问题讨论】:

  • 有同样的问题。令人沮丧的是,这是“转到”教程,但由于说明已过时,您无法通过安装部分。

标签: linux postgresql postgis pgadmin-4


【解决方案1】:

如果您只是想将 shapefile 导入 PostgreSQL,您可能想看看 shp2pgsql

数据样本:TM_WORLD_BORDERS_SIMPL-0.3.zip

解压缩 zip 文件后,只需在控制台中执行以下行:

$ shp2pgsql -I -s 4326 TM_WORLD_BORDERS_SIMPL-0.3.shp table_world | psql -d mydb

需要考虑的事项:

  • table_world 是目标表的名称
  • psql -d mydb 考虑到您当前的操作系统用户在数据库中有一个帐户,不需要密码,数据库安装在 localhost 并且它侦听标准端口 5432。检查psql 文档以构建您自己的连接命令,例如psql -U myuser -h 192.168.1.42 -p 5434 -d mydb 使用用户 myuser 在远程 PostgreSQL 的 192.168.1.42 中的数据库 mydb 登录,该用户在端口 5434 上侦听。如果您的 PostgreSQL 未配置为接受连接,请检查此answer
  • 4326 是 WGS84 的标识符,它是这个 shapefile 的空间参考系统 - 并且在全球范围内最常用。

.. 并且您的数据已准备好进行播放。 pgAdmin4 的geometry viewer 截图:

延伸阅读:

【讨论】:

    猜你喜欢
    • 2018-09-25
    • 1970-01-01
    • 1970-01-01
    • 2017-10-02
    • 2020-07-28
    • 1970-01-01
    • 2022-01-27
    • 2023-01-23
    • 1970-01-01
    相关资源
    最近更新 更多