What is PostGIS?

Mark Altaweel

Updated:

PostGIS is an Open Geospatial Consortium (OGC) compliant software used as a spatial database extender for PostgreSQL, which is a form of object-relational database. While PostGIS is free and open source, it is used in both commercial (e.g., ArcGIS) and open source GIS software (e.g., QGIS).

What does PostGIS do?

PostGIS extends capabilities of PostgreSQL to increase its management capabilities by adding geospatial types and functions to enhance spatial data handled within a relational database structure.

PostGIS has a similar language to SQL

The language of PostGIS is similar to SQL and allows spatial analysis and typical queries to be performed on spatial data with relative ease. This makes it a relatively powerful backend for databases within larger software, helping projects to use SQL-like functionality to do more complex spatial analysis and query.[1]

Introduction to PostGIS

Kayla Patel, a member of the city of Boston’s Analytics Team has a three-part write up introducing PostGIS.  PostGIS is an open source extender for PostgreSQL. PostGIS extends the capabilities of PostgreSQL,  increasing its management capabilities by adding geospatial types and functions to enhance spatial data handled within a relational database structure (more: What is PostGIS?).


Free weekly newsletter

Fill out your e-mail address to receive our newsletter!
Email:  

The first part of the Introduction to PostGIS series provides an over of the open source software program including how and why to use it, how to use it with Boston’s GIS toolsets, and using it to work with map projections.

Part two reviews how to add and populate a geometry column, checking what the map projection is off a GIS dataset, how to transform a dataset to a different map projection, and how to get X and Y coordinate values from a geometry column.

Part three, entitled “How to get insights from your data”, dives into more advanced functionality of PostGIS.  This includes spatial indexing, spatial joins, buffering, finding the nearest, and clustering.

Each concept review in the introduction to PostGIS contains links for further reading and resources.

Advantages of PostGIS

Advantages for PostGIS is it is relatively easy to manage and use, compared to typical data storage on GIS software, as often the data are within one database structure.[2]

In addition to making it easier for spatial-based queries, data can also be accessed much easier using third party software or other programs, including web server functionality. This is because it uses standard simple feature formatting that allows other types of spatial software to potentially use the same stored data.[3]

Another benefit is that analysis across software using the same stored data is relatively easier as well. For users that are use to using SQL, the most common type of database query language, PostGIS is relatively easy to use, as it use the same approach to conduct its queries. A

nalytical and processing functions can also be carried out within PostGIS for raster data and vector data, allowing easy generation of maps that have the desired analytical result. Typical Esri vector formats such as shapefiles and raster types such as GeoTiffs are often handled, although users have a range of geometries and spatial formats in which they can store their data.

PostGIS logo.

Is PostGIS the best approach to spatial problems?

While PostGIS has enabled various projects to benefit from its powerful backend, there is debate if using PostGIS is the best approach to different spatial functions. Recent NoSQL methods, that often utilize a more object-oriented style in structuring data or allow users to create their own storage structure, have been demonstrated to be potentially faster in data retrieval for more complex queries such as simultaneous multiple-user queries.[4]

The relational model that PostGIS uses may not always retrieve complex queries as fast based on how data is stored and accessed, while more flexible approaches, where GIS users can construct their own format for data storage, may prove faster.

Other have also found that PostGIS may not always scale as well to larger spatial database problems, while NoSQL may be easier to distribute or scale more easily across multiple computers. This could be particularly important for web servers that have large spatial data storage needs.[5]

To circumvent the potential limitations and preferences of users, open source software such as QGIS have now integrated plugins for both types of database approaches. Popular tools such as MongoDB, which is a NoSQL approach, is an example database type that is now also used also with PostGIS.

To a large extent, the use of different NoSQL vs. PostGIS (or SQL) approaches is still largely a form of preference, as these two types of approaches have different forms of retrieval queries and the query formats are different.

Users generally become more comfortable with one approach, where the limitations of the software may not be a major issue for the major of work done. For most users, there will often be negligible differences between the two approaches in terms of performance.

References 

[1] For more on PostGIS and software used, see: http://postgis.net/documentation/ and Mikiewicz, D., Mackiewicz, M. & Nycz, T. (2017) Mastering PostGIS: create, deliver, and consume spatial data using PostGIS. [Online]. Available from: http://proquest.safaribooksonline.com/?fpi=9781784391645 [Accessed: 26 September 2017].

[2] For more on data usage and ease for PostGIS, see:  Lijing Zhang & Jing Yi (2010) Management methods of spatial data based on PostGIS. In: [Online]. August 2010 IEEE. pp. 410–413. Available from: doi:10.1109/PACCS.2010.5626962 [Accessed: 26 September 2017].

[3] For more on PostGIS advantages, see:  Marquez, A. (2015) PostGIS essentials: Learn how to build powerful spatial database solutions with PostGIS quickly and efficiently. Community experience distilled. Birmingham, Packt Publishing.

[4] For more on the use of NoSQL and PostGIS, see:  Agarwal, S. & Rajan, K.S. (2016) Performance analysis of MongoDB versus PostGIS/PostGreSQL databases for line intersection and point containment spatial queries. Spatial Information Research. [Online] 24 (6), 671–677.

[5] For more on scalability of database approaches, see:  Pokorny, J. (2013) NoSQL databases: a step to database scalability in web environment. International Journal of Web Information Systems. [Online] 9 (1), 69–82. Available from: doi:10.1108/17440081311316398.

This article was first published on September 28, 2017 and has since been updated.

Related

Photo of author
About the author
Mark Altaweel
Mark Altaweel is a Reader in Near Eastern Archaeology at the Institute of Archaeology, University College London, having held previous appointments and joint appointments at the University of Chicago, University of Alaska, and Argonne National Laboratory. Mark has an undergraduate degree in Anthropology and Masters and PhD degrees from the University of Chicago’s Department of Near Eastern Languages and Civilizations.