How to install PostGIS
By Dillon Smart · · · 0 Comments
PostGIS is a plugin which adds support for storing, indexing and querying geographic data in PostgreSQL databases.
To get started with PostGIS, you will need to install the extension on your PostgreSQL database. If you are using PostgreSQL as a service from a cloud provider, you may already have PostGIS installed.
How to check if PostGIS is installed
You can check if PostGIS is installed either by the command line or by executing a simple SQL query.
Via the command line:
\dx
Via SQL:
select * from pg_extension
Using both these methods, you can see all extensions installed on your PostgreSQL database.
Install PostGIS on MacOS
To install PostGIS on MacOS you must first install Homebrew, the widely used package managed for MacOS.
Follow the instructions on the Homebrew website to get started.
Open a new terminal window and install PostGIS via homebrew.
brew install postgis
Once the installation has completed, connect to your PostgreSQL database via the terminal or use a database management tool such as TablePlus, DBeaver or PgAdmin.
Once connected to your database, create the PostGIS exention by executing the following command:
CREATE EXTENSION postgis;
Install PostGIS on Windows
To install PostGIS on windows, follow the installation instructions from the official website.
Once the installation has completed, connect to your PostgreSQL database.
Similar to MacOS, once you have connected to your database, execute the following command:
CREATE EXTENSION postgis;
This step can also be completed using a database management GUI.
Install PostGIS on Ubuntu
To install PostGIS on Ubuntu, you will need to install the apt package.
sudo apt-get install postgis
Again, similar to MacOS and Windows, connect to your database via the command line or use a database management tool to execute the following command:
CREATE EXTENSION postgis;
0 Comment