Learning: Spatial database

A while ago I was asked a question about Spatial database and figured out I didn’t know anything about it. So, I use this platform to document my learning about this topic.

What is Spatial data?

The first lesson in “database 101” is that the design of a database should fit to the queries made on it. The special thing about spatial databases is that they hold data about objects in a geometric spaces. Most of the traditional databases don’t index the information in an optimize way for spatial queries, examples for such queries can be –

  • How to far is location A to location B?
  • How to get from location A to location B?
  • What is the closest restaurants to some location?
  • What is the path people usualy take in some park \ market?
  • Is location A inside city B?

We can divide spatial queries to few groups (based on Wikipedia)

  • Spatial Measurements: Computes line length, polygon area, the distance between geometries, etc.
  • Spatial Functions: Modify existing features to create new ones, for example by providing a buffer around them, intersecting features, etc.
  • Spatial Predicates: Allows true/false queries about spatial relationships between geometries. Examples include “do two polygons overlap” or ‘is there a residence located within a mile of the area we are planning to build the landfill?’
  • Geometry Constructors: Creates new geometries, usually by specifying the vertices (points or nodes) which define the shape.
  • Observer Functions: Queries which return specific information about a feature such as the location of the center of a circle.

What is next?

This post is actually the preview for additional two posts – a theoretic one and a productive one.

The theoretic one will compare the different spatial indices and on which needs each of them answers. This post will talk about the most common index of this kind is R-Tree and some of its’ extensions and presumably some additional related theory.

The productive one will present some of the current solutions for spatial data among them is PostGis used in PostgreSQL, MySQL and additional NoSQL solution (probably either Neo4j or MongoDB).

Beside the basic curiosity of learning a new thing I believe that the field of “Location intelligence”, i.e., using and analyzing spatial information as part of the decision making process, is an emerging field yet to be discovered. In other words location intelligence is another layer of business intelligence (BI) and as the technology evolves and the data is gathered we can now use this data better than ever before.

Some of the current commercial application of location intelligence – 

  • Route planning – such as Waze
  • Geo targeting – for example using IP address to display relevant ads. 
  • Travel planning – hotel, restaurant, attractions such as GetYourGuide
  • Sales analysis – such as SpatialKey

 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s