

- #POSTGRESQL VS MYSQL FOR SPATIAL DATA HOW TO#
- #POSTGRESQL VS MYSQL FOR SPATIAL DATA INSTALL#
- #POSTGRESQL VS MYSQL FOR SPATIAL DATA UPGRADE#
In this article, we will look into the following geographical data types. The above figure shows all the available geometrical data types available to work in PostgreSQL. There are various spatial data types that can be used to perform spatial data analysis as follows.įigure 2 – Geometry Data Types in PostgreSQL By knowing the latitude and longitude coordinates we can give the exact location of any place in the world. If we consider the surface of the earth on a plane, lines of latitude and longitude are used to describe the exact position of a location on that surface.įigure 1 – Lines of Latitude and Longitude across the surface of the earth – ( Source)Īs you can see in the figure above, the horizontal and the vertical lines across the surface of the earth can be used to exactly locate places on the surface of the earth.
#POSTGRESQL VS MYSQL FOR SPATIAL DATA HOW TO#
Before moving further, let us also brush our knowledge on how to interpret geographical data in the real world. In this article, we will specifically look into the POINT data type and understand how to create and work with it. There are multiple data types that deal with geographical data such as points, lines, polygon, etc. In order to work with geographical data, the databases use a special data type.

Performing spatial analysis with such data is beyond the scope of this article and will be addressed in the future.Ĭomponents of the Spatial Data Types in PostgreSQL This article is just an introduction to the basic data type, POINT, in which the data is stored in the database. In PostgreSQL, these functions can be made available in the form of an extension known as the PostGIS. These functions are designed to work with geographical data and give us the answers that we are actually looking for. In order to answer these questions, we need a special set of functions within the databases. What is the best route from Location X to Location Y? What are the bus stops within 500 meters from Location X?

A few examples of such Spatial Analysis would be as follows. As such, there are a specific set of tools and methodologies that involve such kind of geographical data analysis. It is an extended version of data analysis in which the focus is on geographical data rather than normal data. In simple terms, the study of patterns, anomalies, and theories within spatial or geographical data is termed Spatial Data Analysis. Spatial Data Analysis and Why is it required?īefore diving deep into the technical stuff of working with Spatial Data, let us first understand what spatial data analysis is all about and why is it required. If you want to have a descriptive overview of the PostGIS extension and how it works, I recommend you have a look at the official documentation for PostGIS. The PostGIS will add specific functions that allow us to work with geographical data within the PostgreSQL database. PostGIS is an add-on library that can be installed to an existing instance of a PostgreSQL database. Once you have correctly installed the PostgreSQL database and enabled the PostGIS extension, you can then follow this article to understand more about the different spatial data types associated with PostGIS. It is highly recommended that you follow the tutorial to set up an environment first and then continue with this article further on.
#POSTGRESQL VS MYSQL FOR SPATIAL DATA INSTALL#
You can also download and install the PostGIS extension on a Windows machine by following similar steps.
#POSTGRESQL VS MYSQL FOR SPATIAL DATA UPGRADE#
In my previous article, Install and upgrade PostgreSQL to support Spatial Data, I have demonstrated how to install a PostgreSQL database on a Mac and how to enable the PostGIS extension using which spatial or geographical data can be inserted into the database and spatial queries can be executed. In this article, we are going to discuss in detail what a spatial database is and the data type, POINT that is supported by PostgreSQL to perform geographic data analysis.
