使用pgadmin 4在Linux中的Postgresql中导入shapefile [英] Importing shapefiles in postgresql in linux using pgadmin 4

查看:157
本文介绍了使用pgadmin 4在Linux中的Postgresql中导入shapefile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是postGIS的新手,我在关注

进一步阅读:

I am new to postGIS, I was following this tutorial.

I can't get past the installation part because the instructions are outdated.

I got stuck when it says return to the Dashboard, and click on the Import shapefiles link in the PostGIS section.

I am using pgadmin 4 and I am unable to find the postGIS section there.

解决方案

If you're simply trying to import shapefiles into PostgreSQL, you might wanna take a look at shp2pgsql.

Data sample: TM_WORLD_BORDERS_SIMPL-0.3.zip

After unpacking your zip file just execute the following line in your console:

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

Things to take into account:

  • table_world is the name of the target table
  • psql -d mydb takes into account that your current operating system user has an account in the database, that no password is required, that the database is installed at localhost and that it listens at the the standard port 5432. Check the psql documentation to build your own connection command, e.g. psql -U myuser -h 192.168.1.42 -p 5434 -d mydb to login with the user myuser in the database mydb in the remote PostgreSQL at 192.168.1.42 that listens at the port 5434. In case your PostgreSQL isn't configured to accept connections, check this answer.
  • 4326 is the identifier for WGS84, which is the spatial reference system of this shapefile - and the most often used worldwide.

.. and your data is ready to be played with. Screenshot from the geometry viewer of pgAdmin4:

Further reading:

这篇关于使用pgadmin 4在Linux中的Postgresql中导入shapefile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆