Postgres by BigSQL includes the PostGIS extension, version 2.2 & 2.3, a powerful open source spatial and geographic data management package. PostGIS enables mapping, distance calculations, and geometry functions such as identifying if a point is within a polygon.
Install and Enable PostGIS
Using PostGIS with BigSQL is easy, simply install the
via pgc command line or BigSQL Manager and then enable the extension in the database you
want to use PostGIS functions. First, install PostGIS for your version of Postgres.
For example, to install PostGIS with PostgreSQL v9.6 run the following:
C:\Program Files\PostgreSQL>pgc install postgis23-pg96 ['postgis23-pg96'] Get:1 http://s3.amazonaws.com/pgcentral postgis23-pg96-2.3.0-win64 Unpacking postgis23-pg96-2.3.0-win64.tar.bz2
Then create the postgis extension. To do this in psql, connect to your database and run the following:
mydb=# create extension postgis; CREATE EXTENSION mydb=# select st_distance_sphere(st_makepoint(-74.408934, 40.469244),st_makepoint(78.422142, 17.426312)); st_distance_sphere -------------------- 12991160.3288215 (1 row) mydb=#
First, we enabled PostGIS in the database by running "CREATE EXTENSION". Then, we used one of the PostGIS distance functions to calculate the distance between two cities on the planet.
Learn MoreTo learn more about PostGIS, please visit the PostGIS website.
- Platforms: Linux, OSX, Windows
- PostgreSQL Versions: Postgis v2.2: pg9.5, 9.4, 9.3, 9.2 Postgis v2.3: pg9.6, 9.5