使用pgadmin 4在Linux中的Postgresql中导入shapefile [英] Importing shapefiles in postgresql in linux using pgadmin 4
问题描述
我是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 tablepsql -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 port5432
. Check thepsql
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 usermyuser
in the databasemydb
in the remote PostgreSQL at192.168.1.42
that listens at the port5434
. In case your PostgreSQL isn't configured to accept connections, check thisanswer
.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屋!