问题
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.
回答1:
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_worldis the name of the target tablepsql -d mydbtakes 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 the psql documentation to build your own connection command, e.g.psql -U myuser -h 192.168.1.42 -p 5434 -d mydbto login with the usermyuserin the databasemydbin the remote PostgreSQL at192.168.1.42that listens at the port5434. In case your PostgreSQL isn't configured to accept connections, check this answer.4326is 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:
- psql
- shp2pgsql tutorial
来源:https://stackoverflow.com/questions/60036327/importing-shapefiles-in-postgresql-in-linux-using-pgadmin-4