pgAdmin is a feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world, which includes, among others, the Postgis spatial extention.
pgAdmin is developed by a community of PostgreSQL experts around the world and is available in more than a dozen languages. It is Free Software released under the PostgreSQL License.
pgAdmin is aimed to answer the needs of all users, from writing simple SQL queries to developing complex databases. The graphical interface supports all PostgreSQL features and makes its administration easy. The application includes, among other things: syntax highlighting SQL editor, a server-side code editor, an SQL/batch/shell job scheduling agent, and much more. See more about it in the official website.
Quick start guide¶
To execute this Quick Start Guide you will need a running instance of PostgreSQL database with the spatial extension PostGIS installed, please ask your system administrator for the connection parameters. For further information about PostgreSQL or PostGIS see Online resources.
The following quick start guide will introduce you to pgAdmin basics. It will show how to access to a spatially enabled database and run some simple queries on its tables.
Download the data for this tutorial
hereand unzip it anywhere you think it’s convenient.
Import the geodata from the shapefile into the database, if you have shp2pgsql command line utility at hand you can import the data with:
shp2pgsql events.shp | psql -U postgres pg_test
If you don’t have this command available you can still use QGIS db manager to import you data into the database.
#. Open pgAdmin4 using any of the available shortcuts in your computer.
By default, pgAdmin4 will show the following window on opening:
On the Browser panel, right-click on the Servers, and navigate to to create a new database connection.
In the Create - Server dialog, enter the connection Name. Click the Connection tab, enter the connection parameters in the dialog and click Save.. figure:: img/
A database connection is usually identified by:
Click on the newly added server to open its objects tree and select the events table or any other table you want to query. Then, click the Properties tab.
Perform operations on selected tables with
Preview data with
In the menus, click
In the query editor, type the following query:
SELECT name, St_AsText( geom ) FROM events;
Then, click the Execute/Refresh button or press