HERE Technologies and Wherobots announce partnership Learn More

What is a Geospatial Database? Definition, Examples

Authors

A geospatial database stores the shapes and locations of things on Earth, such as buildings and roads, and lets you query them with SQL (Structured Query Language). It has three parts. Geometry types hold the shapes. A spatial index finds the shapes near a place without reading every row. Spatial SQL functions measure and compare shapes.

The spatial index sets how much data a query reads. In Wherobots, the Overture Maps buildings table holds 2,533,842,612 buildings in 5,141 files. Each file records a bounding box: the smallest rectangle around the buildings inside it. A query that filtered on those boxes left 7 of the 5,141 files to read.

Key takeaways

  • A geospatial database has three parts: geometry types, a spatial index, and spatial SQL functions.
  • Most geometry types follow one standard, Simple Features, from the Open Geospatial Consortium. The types are points, lines, polygons and their multi-part forms.
  • Spatial indexes such as the R-tree work on bounding boxes. Table formats such as Apache Iceberg store one bounding box per data file.
  • A box filter on Overture's bbox column left 7 files (0.46 GB) to read. The same box, written as a test on each building's centroid (center point), left all 5,141 files (253.2 GB).
  • The best geospatial database depends on the workload. The options range from a single file to a distributed engine, which runs on many machines.

What is a geospatial database?

Ralf Hartmut Güting gave the classic geospatial database definition in An introduction to spatial database systems (The VLDB (Very Large Data Bases) Journal, 1994). In it, a spatial database system is a database system first. Its data model and query language include spatial data types. Its software supports those types with, at least, spatial indexing and efficient spatial join algorithms. A spatial join matches the rows of two tables by location.

The PostGIS workshop on spatial indexing calls the spatial index "one of the three key features of a spatial database".

Spatial database and geospatial database often mean the same thing. A spatial database can store shapes on any plane, including one with no units. A geospatial database ties coordinates to the Earth. It does so through a coordinate reference system (CRS), the definition that places each coordinate on the planet. Our article on the coordinate reference system explains it.

A GIS (geographic information system) is software for viewing, editing and analyzing map layers. A geospatial database stores those layers as tables. It returns answers to queries from many programs, a GIS among them. Our article on geospatial data covers the data itself.

Geospatial database management is the work around the three parts. The PostGIS data management chapter covers it: geometry types, reference systems, validation, loading, and spatial indexes.

Geometry types and the Simple Features model

Most geospatial databases share one geometry model. The Open Geospatial Consortium (OGC), a standards body for geospatial data, publishes it as Simple Feature Access, Part 1: Common Architecture. The International Organization for Standardization (ISO) publishes the same model as ISO 19125. The model defines one general Geometry type with four subtypes: Point, Curve, Surface and GeometryCollection. Each geometry belongs to a spatial reference system, another name for a CRS.

The PostGIS manual lists the concrete types:

  • Point: one location.
  • LineString: a line of connected straight segments.
  • Polygon: an area bounded by an outer ring, with zero or more holes.
  • MultiPoint, MultiLineString and MultiPolygon: collections of one type.
  • GeometryCollection: a collection that mixes types.

Each geometry also has an envelope: the smallest upright box that contains it. Wherobots' Havasu documentation calls it the minimum bounding rectangle (MBR), or bounding box. Every index in the next section works on these boxes. A feature is one mapped thing, such as a building, with its shape and its facts. Part 2 of the standard, the SQL option, defines a SQL schema, a standard table layout, to store, retrieve, query and update features.

These geometry types are vector types. Each one describes a separate feature. Raster data stores a grid of cells, such as a satellite image. The Havasu table spec defines a raster type beside the geometry type. Raster vs vector data compares the two models.

One query on three Overture Maps tables shows the vector types in use. Overture Maps is an open map dataset. The box around King County, Washington, runs from longitude -122.6 to -120.9 and latitude 47.0 to 47.8. Overture stores each feature's bounding box in a bbox column.

SELECT 'buildings_building' AS source, ST_GeometryType(geometry) AS geometry_type, COUNT(*) AS features
FROM wherobots_open_data.overture_maps_foundation.buildings_building
WHERE bbox.xmin >= -122.6 AND bbox.xmax <= -120.9 AND bbox.ymin >= 47.0 AND bbox.ymax <= 47.8
GROUP BY ST_GeometryType(geometry)
UNION ALL
SELECT 'places_place', ST_GeometryType(geometry), COUNT(*)
FROM wherobots_open_data.overture_maps_foundation.places_place
WHERE bbox.xmin >= -122.6 AND bbox.xmax <= -120.9 AND bbox.ymin >= 47.0 AND bbox.ymax <= 47.8
GROUP BY ST_GeometryType(geometry)
UNION ALL
SELECT 'transportation_segment', ST_GeometryType(geometry), COUNT(*)
FROM wherobots_open_data.overture_maps_foundation.transportation_segment
WHERE bbox.xmin >= -122.6 AND bbox.xmax <= -120.9 AND bbox.ymin >= 47.0 AND bbox.ymax <= 47.8
GROUP BY ST_GeometryType(geometry)
TableGeometry typeFeatures
buildings_buildingST_Polygon1,283,254
buildings_buildingST_MultiPolygon78
places_placeST_Point177,411
transportation_segmentST_LineString551,134

Buildings are polygons, places are points, and road segments are lines.

Spatial indexes set how much data a query reads

An index is a lookup structure that finds rows without reading the whole table. A B-tree, the usual database index, sorts rows by one value. A location has two values, longitude and latitude. A B-tree on either one returns a whole strip of the map.

Spatial indexes work on bounding boxes. The PostGIS workshop describes two passes. First, the index finds the features whose boxes overlap the query box. Then an exact test runs on those features only.

Oracle documents the same two-tier query model. Our spatial join article shows how joins use these two passes, called filter and refine.

  • R-tree: Antonin Guttman introduced R-trees: a dynamic index structure for spatial searching in 1984. The paper appeared at SIGMOD (Special Interest Group on Management of Data), a conference of the Association for Computing Machinery (ACM). The tree nests nearby boxes inside larger rectangles, and a search enters only the rectangles that overlap its box. Norbert Beckmann, Hans-Peter Kriegel, Ralf Schneider and Bernhard Seeger improved how the tree's nodes are chosen and split in The R*-tree (ACM SIGMOD, 1990). PostGIS builds its R-tree on GiST (Generalized Search Tree), a PostgreSQL framework for building tree indexes.
  • Quadtree: Raphael Finkel and Jon Bentley described Quad trees (Acta Informatica, 1974). A quadtree splits space into four quadrants. It then splits each crowded quadrant into four again. PostGIS offers quadtrees through SP-GiST, its space-partitioned GiST method.
  • Grid cells: A grid gives each feature a cell ID. An ordinary index on the ID then finds the features in an area. H3 is a hexagonal grid of this kind, and Oracle Spatial documents H3 indexing.
  • Block and file bounding boxes: A block is a fixed-size chunk of a table on disk. A PostGIS BRIN (block range index) stores one box for each range of table blocks. The Apache Iceberg table spec stores the lowest and highest value of each column in each data file. Its version 3 adds geometry types. For those types, the file bounds form a bounding box around every object in the file.

Havasu is the Wherobots table format built on Iceberg. It records each file's bounding box (MBR) when the file is written. According to the Havasu clustering documentation, the engine then skips every file whose bounding box misses the query's spatial filter. Wherobots calls this spatial filter push-down: the filter is checked against the file boxes before any file is read.

Box indexes share one condition. The PostGIS manual says a BRIN index is efficient only if the boxes of the block ranges overlap little. The Havasu documentation says push-down "works best when the spatial data near to each other were stored in the same file". In both, the order of rows on disk sets how much a query can skip.

The PostGIS manual names a cost of GiST indexes too. A GiST index performs well while it fits in memory and while the cost of updating it on each write is acceptable.

Spatial SQL functions and predicates

Spatial SQL is SQL with functions that take or return geometry. Most systems name them with an ST_ prefix. The functions include constructors, measurements, predicates and operations:

  • Constructors build geometry. ST_GeomFromText, for example, reads well-known text (WKT), a plain-text geometry format.
  • Measurements include ST_Area and ST_Distance.
  • Predicates are true-or-false tests, such as ST_Intersects and ST_Contains.
  • Operations such as ST_Buffer and ST_Union return new geometry.

Two standards define these functions. One is the OGC SQL option. The other is ISO/IEC 13249-3, SQL Multimedia Part 3: Spatial (SQL/MM Spatial). PostGIS uses SQL/MM for curved types built from circular arcs. The OGC group that maintains Simple Features is working to synchronize it with SQL/MM Part 3.

The predicates come from topology research. Topology, here, is the math of how shapes touch, overlap and contain each other. Max Egenhofer and Robert Franzosa wrote Point-set topological spatial relations (International Journal of Geographical Information Systems, 1991). It defined the relations between two regions from their boundaries and interiors.

Only some predicates use an index. The PostGIS workshop lists the functions that use one automatically, among them ST_Intersects, ST_Contains, ST_Within and ST_DWithin. The index holds boxes of the stored geometry. It has no entries for a value computed at query time, such as the longitude of a building's centroid.

A data lake table is a table stored as plain files in cloud storage. The Wherobots test below measures what a computed value costs on one.

Geospatial database examples

A familiar geospatial database example is PostGIS. Each description below comes from the product's own documentation or paper.

Single-node databases

A single-node database runs on one server.

  • PostGIS: PostGIS extends the PostgreSQL relational database to store, index and query geospatial data. It has geometry and geography types; GiST, SP-GiST and BRIN spatial indexes; and raster support.
  • Oracle Spatial: Oracle describes Spatial as a set of functions, procedures, data types and data models in the Oracle database. Vector geometry uses the SDO_GEOMETRY type.
  • SQL Server: Microsoft's SQL Server spatial data has a geometry type for flat coordinates and a geography type for round-earth coordinates. Both support spatial indexes.
  • SpatiaLite: SpatiaLite extends SQLite, a SQL engine in one library. A whole database is one file. Its developers call it mostly compliant with the OGC SQL option.

Cloud data warehouse

A data warehouse is a database built for analysis of large tables.

Distributed engines

A distributed engine splits a table into parts, called partitions. It processes them on many machines at once.

  • Hadoop-GIS: Ablimit Aji and colleagues described Hadoop GIS: a high performance spatial data warehousing system over MapReduce (Proceedings of the VLDB Endowment, 2013). Hadoop is an open-source system for processing data on a cluster, a group of machines that work together. MapReduce is the Hadoop model that splits a job into tasks across a cluster.
  • SpatialHadoop: Ahmed Eldawy and Mohamed Mokbel described SpatialHadoop: a MapReduce framework for spatial data in 2015. The paper appeared at ICDE (International Conference on Data Engineering), a conference of the IEEE (Institute of Electrical and Electronics Engineers).
  • Apache Sedona: Jia Yu, Jinxuan Wu and Mohamed Sarwat introduced it as GeoSpark (ACM SIGSPATIAL, 2015). GeoSpark was a cluster computing framework for spatial data on Apache Spark, an engine that runs data jobs across a cluster. Apache Sedona now runs on one machine, on Spark clusters, on Apache Flink streams and inside Snowflake. It lists more than 300 spatial functions for raster and vector data.
  • WherobotsDB: Yu and Sarwat founded Wherobots. WherobotsDB is its distributed spatial SQL engine. It grew out of Sedona. It reads and writes Havasu tables of geometry and raster columns.

File and table formats

A format stores spatial data, and an engine queries it. GeoParquet is an incubating OGC standard. It adds geospatial types to Apache Parquet, a file format that stores data column by column.

Apache Iceberg is a table format. Its metadata groups many Parquet files into one table, with statistics for each file. The Havasu Catalog article explains how Wherobots catalogs such tables.

Single-node database vs distributed engine vs table format

Compared onSingle-node spatial databaseDistributed spatial engineSpatial file or table format
ExamplesPostGIS, Oracle Spatial, SQL Server, SpatiaLiteApache Sedona, WherobotsDB, SpatialHadoop, Hadoop-GISGeoParquet, Apache Iceberg version 3, Havasu
Where data sitsThe database's own storage; for SpatiaLite, one fileFiles in shared storage, read by many workersData files plus metadata in object storage
Spatial indexR-tree (GiST), quadtree (SP-GiST), or BRIN block boxesSpatial partitions, plus an R-tree or quadtree built for a joinA bounding box per file in the metadata
Spatial SQLST_ functions in the databaseST_ functions run across the clusterNone; an engine supplies it
How it growsA larger serverMore workersMore files

A worker is one machine in a cluster. Object storage is cloud file storage, such as Amazon S3, that many machines read at once. A spatial partition is a region of the map whose features go to one worker. The partitioning tax article covers the edges between partitions.

How to choose a geospatial database by workload

Choosing a database for geospatial data starts with the workload. There is no single best geospatial database. These rules match each workload to a system type in the table:

  1. If many users edit single features, as in an app for editing land parcels, use a relational database with spatial types, such as PostGIS, Oracle Spatial or SQL Server. The PostGIS manual notes that a GiST index is updated on each write.
  2. If one person or one app needs one portable file, use SpatiaLite for edits or GeoParquet for analysis.
  3. If the data already sits in a warehouse and spatial queries are occasional, use its spatial type, such as BigQuery's geography type.
  4. If a table's R-tree no longer fits in one server's memory, the PostGIS manual suggests BRIN on rows stored in spatial order, so nearby features sit together. Past that, or to join two large tables, use a distributed engine. Varun Pandey, Andreas Kipf, Thomas Neumann and Alfons Kemper compared such engines in How good are modern spatial analytics systems? (Proceedings of the VLDB Endowment, 2018).
  5. If the data lives as files in object storage, keep per-file bounding boxes in the metadata. Sort the rows so nearby features share files.

We tested rule 5 on one table in Wherobots.

Geospatial databases in Wherobots

The test

A query plan lists the steps the engine runs for a query. The scan is the step that reads the table's files.

  • Claim: the spatial index or the file bounds set how much data a spatial query reads.
  • What would support it: a box filter the scan can use leaves few files to read. The same box as a computed test leaves all of them. A spatial join plan shows a spatial index.
  • What would break it: both filters leave the same files, or the join plan has no spatial index.
SourceRowsUsed for
Overture buildings2,533,842,612 in 5,141 filesBuilding polygons with a bbox column
Overture division areasWashington county polygonsCounties for the spatial join

Count the table's files and the files the box touches

Query 1 reads the .files table. It is an Apache Iceberg metadata table, with one row per data file. Each row holds the file's row count, its size, and the lowest and highest value of each column. Reading it opens no data file.

SELECT COUNT(*) AS files, SUM(record_count) AS rows, ROUND(SUM(file_size_in_bytes) / 1e9, 1) AS gb
FROM wherobots_open_data.overture_maps_foundation.buildings_building.files

The buildings table has 5,141 files. They hold 2,533,842,612 rows and 253.2 GB. The next query counts the files whose bbox bounds overlap the King County box:

WITH f AS (
  SELECT record_count, file_size_in_bytes AS bytes,
    readable_metrics.`bbox.xmin`.lower_bound AS xmin, readable_metrics.`bbox.xmax`.upper_bound AS xmax,
    readable_metrics.`bbox.ymin`.lower_bound AS ymin, readable_metrics.`bbox.ymax`.upper_bound AS ymax
  FROM wherobots_open_data.overture_maps_foundation.buildings_building.files
)
SELECT COUNT(*) AS files_total,
  SUM(CASE WHEN xmin IS NULL THEN 1 ELSE 0 END) AS files_without_bounds,
  SUM(CASE WHEN xmax >= -122.6 AND xmin <= -120.9 AND ymax >= 47.0 AND ymin <= 47.8 THEN 1 ELSE 0 END) AS files_touching_king_county_box,
  SUM(CASE WHEN xmax >= -122.6 AND xmin <= -120.9 AND ymax >= 47.0 AND ymin <= 47.8 THEN record_count ELSE 0 END) AS rows_in_those_files,
  ROUND(SUM(CASE WHEN xmax >= -122.6 AND xmin <= -120.9 AND ymax >= 47.0 AND ymin <= 47.8 THEN bytes ELSE 0 END) / 1e9, 2) AS gb_in_those_files
FROM f
FilesFiles without boundsFiles touching the boxRows in those filesGB in those files
5,141073,702,7310.46

Every file has bounds, and 7 overlap the box. The query ran in 2.9 seconds. Five of the 7 files cover parts of western Washington. The other two span most of a continent:

  • One spans longitude -179.80 to -90.10 and latitude 23.87 to 79.42, with 517,022 rows. The Havasu Catalog article reports a file with the same bounds near Lake Havasu City, Arizona.
  • The other spans longitude -122.54 to -2.06 and latitude -7.74 to 70.85, with 599,661 rows.
Map of Washington and neighboring states with the recorded bounding boxes of 23 Overture building data files drawn as rectangles. A pink box marks the King County query area. Yellow rectangles mark the seven files that touch it. Two of these files have continent-wide bounds and run off the edge of the map. Gray dashed rectangles mark files the filter skips
Bounding boxes of the Overture buildings data files near Washington, from the Apache Iceberg files metadata table in Wherobots. 7 of 5,141 files touch the King County box.

A box filter the scan can use

Query 2 counts the buildings whose bounding box lies inside the King County box.

SELECT COUNT(*) AS buildings_in_box
FROM wherobots_open_data.overture_maps_foundation.buildings_building
WHERE bbox.xmin >= -122.6 AND bbox.xmax <= -120.9 AND bbox.ymin >= 47.0 AND bbox.ymax <= 47.8

It returned 1,283,332 buildings in 5.4 seconds. EXPLAIN FORMATTED prints the query plan, the steps WherobotsDB runs. The plan's scan line holds the four bounds:

IcebergScan(table=...buildings_building, ..., filters=bbox.xmin IS NOT NULL, ..., bbox.xmin >= -122.6, bbox.xmax <= -120.9, bbox.ymin >= 47.0, bbox.ymax <= 47.8, ...)

WherobotsDB compares a filter inside IcebergScan with each file's bounds before it opens the file. It skips the files whose bounds miss the box. So the scan reads at most the 7 files from Query 1.

The same box as a test on each centroid

Query 3 tests each building's centroid, the center point of its shape. ST_Centroid computes the centroid from the geometry. ST_X and ST_Y return its two coordinates:

EXPLAIN FORMATTED
SELECT COUNT(*) AS buildings_in_box
FROM wherobots_open_data.overture_maps_foundation.buildings_building
WHERE ST_X(ST_Centroid(geometry)) BETWEEN -122.6 AND -120.9
  AND ST_Y(ST_Centroid(geometry)) BETWEEN 47.0 AND 47.8

The scan line now has an empty filter. A separate Filter step follows the scan:

IcebergScan(table=...buildings_building, ..., filters=, runtimeFilters=, ...)
Filter (ST_X(ST_Centroid(geometry)) ... ST_Y(ST_Centroid(geometry)) ...)

With no filter in the scan, WherobotsDB would read all 5,141 files (253.2 GB). It would then compute a centroid for each of 2,533,842,612 rows before the box test. We ran EXPLAIN only. That avoided a full read on a small shared session, the compute that ran our queries.

Two pairs of bars on a log scale. With the filter on the bbox columns, the scan reads 7 files and 0.46 GB. With the filter written as ST_X and ST_Y of the centroid, the plan has no scan filter, so the scan would read all 5,141 files and 253.2 GB
Files and data the scan reads for the same box, from the Iceberg file metadata and the two query plans in Wherobots. We planned the centroid version and did not run it.

A spatial join with an R-tree

Query 4 is a spatial join. A spatial join matches rows of two tables by a spatial predicate. This one assigns each building's centroid to the Washington county polygon that contains it:

WITH county AS (
  SELECT names.primary AS county, geometry AS g FROM wherobots_open_data.overture_maps_foundation.divisions_division_area
  WHERE country = 'US' AND region = 'US-WA' AND subtype = 'county' AND class = 'land'
),
b AS (
  SELECT ST_Centroid(geometry) AS c FROM wherobots_open_data.overture_maps_foundation.buildings_building
  WHERE bbox.xmin >= -122.6 AND bbox.xmax <= -120.9 AND bbox.ymin >= 47.0 AND bbox.ymax <= 47.8
)
SELECT /*+ BROADCAST(county) */ county.county, COUNT(*) AS buildings
FROM b JOIN county ON ST_Intersects(county.g, b.c)
GROUP BY county.county ORDER BY buildings DESC
CountyBuildings
King County845,001
Pierce County352,515
Kitsap County42,095
Snohomish County31,351
Kittitas County12,194
Chelan County138
Yakima County38

The join ran in 14.8 seconds. The other counties extend past the box, so their counts cover only the part inside it.

The plan shows BroadcastIndexJoin ... INTERSECTS with SpatialIndex g: geometry, RTREE. A hint is an instruction to the engine written inside the SQL. The BROADCAST hint copies the small table, the county polygons, to every worker. WherobotsDB builds an R-tree on those polygons. It then tests the 1,283,332 building centroids against the tree.

The spatial join article compares broadcast and partitioned joins. The nearest-neighbor join announcement covers a related join type.

Horizontal bar chart of Overture buildings per Washington county from the spatial join. King County 845,001, Pierce County 352,515, Kitsap County 42,095, Snohomish County 31,351, Kittitas County 12,194, Chelan County 138 and Yakima County 38
Buildings in the query box per Washington county, from a spatial join with an R-tree index in Wherobots. King County holds 845,001 of them.

Limits of the test

  • We did not run Query 3. The full read reported for it comes from its plan and the file metadata in Query 1.
  • Query 1 counts files whose bounds overlap the box. It does not measure bytes read inside each file.
  • Query 2 counts buildings whose box lies wholly inside the King County box. Query 3 tests centroids. So the two sets differ at the edges.
  • Each run time comes from one run on a small shared session, so none is a benchmark. We ran no comparison with any other system.

Verdict

The results support the claim. A box filter the scan could use left 7 of 5,141 files: 0.46 GB of 253.2 GB. The same box as a centroid test left the scan with no filter and all 5,141 files to read. In the spatial join, WherobotsDB built an R-tree and counted 845,001 buildings in King County.

The file bounds are coarse, though. The 7 files hold 3,702,731 rows for 1,283,332 results, and two of them span most of a continent. That matches the condition in the Havasu documentation: push-down works best when nearby features share files.

Geospatial database research history

The OGC first set out spatial SQL in its Simple Features Specification for SQL. Revision 1.1 (OGC document 99-049) came out on 5 May 1999. Both parts of Simple Feature Access now stand at version 1.2.1. The working group that maintains them is adding new geometry types and support for 3D coordinates, which add height.

Jignesh Patel and David DeWitt described Partition based spatial-merge join (ACM SIGMOD, 1996). Their method joined two inputs that have no index by splitting both into spatial partitions. Hadoop-GIS and SpatialHadoop then used partitioning and indexing on clusters. Yu, Zongsi Zhang and Sarwat described GeoSpark's partitioning, indexing and joins in Spatial data management in Apache Spark: the GeoSpark perspective and beyond (GeoInformatica, 2018). GeoSpark became Apache Sedona.

The newest step stores geometry in open table formats, with a bounding box for each file. In the Iceberg spec, a geometry column with no stated CRS stores longitude and latitude on the WGS 84 (World Geodetic System 1984) datum, named OGC:CRS84. A datum is the model of the Earth's shape that coordinates are measured against. Wherobots described its own format in Havasu: a table format for spatial attributes in a data lake architecture.

Conclusions

  1. A geospatial database is geometry types, a spatial index and spatial SQL. Güting's definition requires spatial types in the query language and spatial indexing. The Overture tables in Wherobots use all three parts.
  2. If a query filters by area, write the filter so the scan can use it. A filter on the bbox columns left 7 of 5,141 files. A computed centroid test left all 5,141 files (253.2 GB). The Havasu Catalog article shows an ST_Intersects filter on a fixed polygon inside the scan too.
  3. The engine can skip data with per-file bounds only as well as the files are laid out. Two of the 7 files span most of a continent. If file bounds are wide, sort the table so nearby features share files. In Havasu, use CREATE SPATIAL INDEX for this. This test did not measure a re-sorted table, so the size of the gain is untested here.
  4. If a join pairs a large table with a small one, broadcast the small one and index it. With the hint, WherobotsDB built an R-tree on the county polygons. It counted 845,001 King County buildings in 14.8 seconds.
  5. Choose the system by workload. Use a relational database for many small edits, a file for one user, a warehouse's spatial type for occasional spatial queries, and a distributed engine for billions of rows. These rules rest on each product's documentation. We ran no cross-product test.

Read more from Wherobots

Query Overture buildings with spatial SQL in a Wherobots free trial at cloud.wherobots.com.

Frequently asked questions

What is a geospatial database?

A geospatial database stores the shapes and locations of things on Earth and lets you query them. It has three parts. Geometry types store points, lines and polygons. A spatial index finds the rows in an area without reading every row. You ask the questions with spatial SQL functions, such as ST_Intersects and ST_Distance.

What is an example of a geospatial database?

PostGIS is a common example. It adds geometry types, spatial indexes and spatial functions to the PostgreSQL database. Others are Oracle Spatial, the geometry and geography types in Microsoft SQL Server, SpatiaLite for SQLite, and the geography type in Google BigQuery. Apache Sedona and WherobotsDB run spatial SQL across a cluster of machines.

What is the best database for geospatial data?

The best choice depends on the workload. For many small edits to single features, use a relational database with spatial types, such as PostGIS. For one user or one app, a single file such as SpatiaLite or GeoParquet works. For billions of rows or joins between large tables, use a distributed engine such as Apache Sedona or WherobotsDB. Run it over files with per-file bounding boxes.

What are the three types of GIS data?

The usual answer is vector data, raster data and attribute data. Vector data stores features as points, lines and polygons. Raster data stores a grid of cells, such as a satellite image. Attribute data is the table of facts about each feature, such as a building’s height. Within vector data, points, lines and polygons are also called the three geometry types.

What is the difference between a spatial database and a geospatial database?

The terms are often used for the same thing. A spatial database can store shapes in any coordinate space, including a plane with no units. A geospatial database ties coordinates to places on Earth through a coordinate reference system. One example is longitude and latitude on WGS 84, the World Geodetic System 1984 that the Global Positioning System (GPS) uses.

What is the difference between a GIS and a geospatial database?

A GIS (geographic information system) is software for viewing, editing and analyzing map layers, often on a desktop. A geospatial database stores those layers in tables and returns answers to queries from many programs. A GIS often reads its layers from a geospatial database.

What is spatial SQL?

Spatial SQL is SQL with functions that take or return geometry. Most systems name them with an ST_ prefix. ST_Intersects and ST_Contains test how two shapes relate. ST_Area and ST_Distance measure. ST_Buffer and ST_Union build new shapes. Two standards define these functions: the Simple Features SQL option of the Open Geospatial Consortium (OGC), and ISO/IEC 13249-3 (SQL/MM Spatial).

Is PostGIS a geospatial database?

Yes. PostGIS is an extension of the PostgreSQL relational database. It adds geometry and geography types, spatial indexes and spatial SQL functions. Its spatial indexes are an R-tree on GiST, a quadtree on SP-GiST, and BRIN boxes for each block range. It also stores raster data.

Can a data lake work as a geospatial database?

Yes, if a table format stores geometry and per-file bounds, and an engine runs spatial SQL over the table. A data lake is a store of plain files in cloud storage. Apache Iceberg version 3 adds geometry and geography types with a bounding box for each data file. In Wherobots, a box filter on 2,533,842,612 Overture buildings used those bounds to limit the read to 7 of 5,141 files.

What is geospatial database management?

Geospatial database management is the work of running a spatial database. It covers loading data, choosing coordinate reference systems, validating geometry and building spatial indexes. It also covers storing nearby features together. That layout sets how many files or blocks an area query can skip.