Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Geospatial Data: Apache Spark vs. PostGIS

DZone's Guide to

Geospatial Data: Apache Spark vs. PostGIS

We take a look at how the big data tool Apache Spark stacks up against the geospatial tool PostGIS when it comes to handling big data sets.

· Big Data Zone ·
Free Resource

How to Simplify Apache Kafka. Get eBook.

In my company, we've had a heated debate about geospatial data processing between old school conservative SQL fans and progressive big data and NoSQL fans.

Data Querying (MongoDB vs. PostGIS)

This section provides an overview of PostGIS and Mongodb, and their geospatial capabilities.


Mongodb Postgis
Spark drivers spark:mongo spark:jdbc
Scalability
  • Incoming data stream can potentially grow without limit.
  • Can scale easily.
  • Difficult to scale.
  • PG10 ?
Response time
  • Slightly faster at returning entire data sets.
  • Integrated caching system.
  • Faster when it comes to geospatial queries (by bounding box for example).
Geospatial index and Geoqueries
  • Bounding box geospatial queries seem to work well but UTM CRS is not supported (should convert data to mercator).
  • Supports only geojson formats.
  • Supported queries ($geoNear, $geoWithin, $geoIntersects).
  • Provides much more sophisticated spatial analytic capabilities.
  • Supports all geometry formats.
  • Supports all CRSs.

Spark vs. PostGIS (Performance)

The purpose of this section is to compare the performance Spark and PostGIS with respect to different data analyses (max, avg, geospatial:within, etc.).

For PostGIS tests, the data is already preprocessed and indexed geospatially, while Spark will use directly raw data (parquet, csv, shape, etc.).

As the data size grows, Spark's response time remains stable while PostGIS's response time grows exponentially.

Max KPI:

Image title

Mean KPI:

Image title

KPIs Within a Bounding Box:

Image title

12 Best Practices for Modern Data Ingestion. Download White Paper.

Topics:
postgis ,postgresql ,geospatial data ,big data ,apache spark

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}