Skip to content
Data models

Geospatial Data

Unified geospatial, time-series, and search analytics with SQL.

CrateDB enables you to store, analyze, and query geospatial data at scale, all with simple SQL. Whether you’re tracking assets in real time, analyzing mobility patterns, running location-aware analytics, or enriching AI models with spatial context, CrateDB delivers the performance, flexibility, and scalability required for modern geospatial workloads.

By combining geospatial processing with time series, full-text search, vector similarity, and structured filters, CrateDB lets you answer complex hybrid questions such as: “Which assets were inside this zone during this timeframe, matching this text profile and semantically similar to this vector?” All inside a single, distributed SQL engine.

 

 

Geospatial data queries with SQL

Hyper-fast. Results in milliseconds.

        

/* Based on Chicago taxi trips, this query lists the longest 5 trips 
   starting within 1km of the Shedd Aquarium and tells us the name
   of the community area that the trip ended within. */
SELECT tripid, 
       miles,
       c.name as dropoff_area
FROM taxi_rides t, community_areas c
WHERE distance('POINT(-87.6118581 41.8672843)'::GEO_POINT, pickupcentroidlocation) < 1000
      AND dropoffcommunityarea = c.areanumber
ORDER BY miles DESC
LIMIT 5; 
        

+------------------------------------------+-------+--------------+
| tripid                                   | miles | dropoff_area |
+------------------------------------------+-------+--------------+
| e6d27fb09f7b17695a71666654c40fd56b79f472 | 46.5  | LOOP         |
| eb8dbd2d81faa21f8f6d80117748a8630c55d55c | 37.27 | OHARE        |
| 6aaa0d2aed0423f1321ff5df949afef0e3583d58 | 37.16 | OHARE        |
| e9ab078e5e6ed4d29cfbd310ee75d47236d3afbb | 32.03 | OHARE        |
| 329b4e6980070cab4c2af19ddbc7b73c1497a669 | 31.67 | OHARE        |
+------------------------------------------+-------+--------------+
        

/* Based on Chicago taxi trips, this query retuern the number 
   of trips per day that started at O'Hare airport and were
   over 20 miles long. */
SELECT date_bin('24 hour'::interval, starttime, 0) AS day,
       count(*) as trips
FROM taxi_rides
WHERE within(
        pickupcentroidlocation, 
        'POLYGON (
          (-87.92151405039768 42.008992106324456, 
           -87.93962405297475 42.00147632076016, 
           -87.94067626623455 41.95592273798644, 
           -87.89918645000783 41.9491763875842, 
           -87.88992003878232 41.95716729007498, 
           -87.8821237584836 41.95716462062882, 
           -87.87074008603852 41.967968085787476, 
           -87.87727540517479 41.99772302560805, 
           -87.89707897269737 42.009775581434354, 
           -87.92151405039768 42.008992106324456)
        )'
      )
      AND miles > 20
GROUP BY day
ORDER BY day DESC;
        

+---------------+-------+
|           day | trips |
+---------------+-------+
| 1714521600000 |    24 |
| 1714435200000 |   110 |
| 1714348800000 |   109 |
| 1714262400000 |    77 |
| 1714176000000 |    52 |
| 1714089600000 |    98 |
| 1714003200000 |   113 |
| 1713916800000 |    82 |
| 1713830400000 |    59 |
| 1713744000000 |    91 |
| 1713657600000 |    69 |
| 1713571200000 |    48 |
| 1713484800000 |    82 |
| 1713398400000 |    75 |
| 1713312000000 |    80 |
| 1713225600000 |    98 |
| 1713139200000 |   104 |
| 1713052800000 |    63 |
| 1712966400000 |    75 |
| 1712880000000 |   142 |
| 1712793600000 |   169 |
| 1712707200000 |   103 |
| 1712620800000 |   154 |
| 1712534400000 |   203 |
| 1712448000000 |    98 |
| 1712361600000 |    71 |
| 1712275200000 |    80 |
| 1712188800000 |    79 |
| 1712102400000 |    72 |
| 1712016000000 |    91 |
| 1711929600000 |    39 |
+---------------+-------+

        

/* Which communities of more than 30,000 people does a flight from O'Hare to 
   Midway airport pass over? */
SELECT name,
       details['population'] AS population
FROM community_areas
WHERE
  intersects (
    'LINESTRING (-87.90753846894022 41.9807787186139, -87.72939445102593 41.97508268795004, -87.55763552335945 41.97982941555023, -87.47846040428642 41.92427055787562, -87.51102436455034 41.837749425166244, -87.59225264192574 41.80057450627759, -87.64801197528328 41.770600684095974, -87.69988112259261 41.7819633786835, -87.7530469985847 41.78583107072223)',
    boundaries
  )
  AND details['population'] > 30000
ORDER BY population DESC;
        

+------------------------+------------+
| name                   | population |
+------------------------+------------+
| UPTOWN                 |      57182 |
| EDGEWATER              |      56296 |
| CHICAGO LAWN           |      55931 |
| ALBANY PARK            |      48396 |
| LINCOLN SQUARE         |      40494 |
| NORWOOD PARK           |      38303 |
| GARFIELD RIDGE         |      35439 |
| WEST LAWN              |      33662 |
| GREATER GRAND CROSSING |      31471 |
+------------------------+------------+

Built for high-volume geospatial workloads

Geospatial data often involves millions of incoming points per second, long historical retention, and dynamic queries across large datasets. CrateDB’s distributed architecture, automatic indexing, and columnar storage give you:

Typical use cases include fleet and asset tracking, route optimization, smart mobility, supply chain analytics, logistics, IoT monitoring, and mapping applications.

Spatio-temporal analytics (location + time)

Most geospatial workloads require understanding not only where assets are, but when they were there. CrateDB combines time series and geospatial capabilities in the same database, enabling you to:

  • Track moving devices and vehicles over time
  • Analyze historical paths, dwell times, and coverage
  • Identify patterns, anomalies, and time-based behaviors
  • Run queries like “show me all assets that entered this area between 7:00 and 8:00”
By storing time, location, and rich metadata side-by-side, CrateDB makes spatio-temporal analysis fast and straightforward.

Native geospatial data types

CrateDB supports geospatial types that cover both simple and complex geometries.

geo_point: Ideal for coordinates, GPS positions, and tracking data. Supported formats include:

  • Array: [longitude, latitude]
  • WKT: POINT(longitude latitude)

geo_shape: For representing polygons, lines, multipolygons, and other complex structures. Supported formats include:

  • GeoJSON
  • WKT (POLYGON, LINESTRING, MULTIPOLYGON, etc.)
These formats ensure compatibility with common geospatial tools, IoT systems, and GIS pipelines.
cr-quote-image

Tunable geospatial indexing

Built on Apache Lucene®, CrateDB gives you fine-grained control over geospatial index precision:

  • Adjust precision and resolution for geo_point and geo_shape
  • Optimize for speed, accuracy, or index size
  • Choose the level of spatial granularity that matches your workload
This allows coarse-grained indexing for large-scale proximity searches, or fine-grained indexing for high-precision boundary queries.
cr-quote-image

Geospatial functions & spatial analytics

CrateDB includes built-in geospatial functions for fast and accurate spatial reasoning.

Spatial count: Find how many records fall within a specific area.
within(shape, area)

Spatial distance: Identify nearest assets or events.
distance(pointA, pointB)

Spatial overlap: Check whether two areas intersect or overlap.
intersects(shapeA, shapeB)

Example SQL queries:
-- Find all scooters within 200 meters of a given location
SELECT id, status, last_seen
FROM scooters
WHERE distance(scooters.position, [7.4474, 46.9480]) < 200;

-- Count active devices inside a city boundary
SELECT count(*)
FROM devices
WHERE within(
    devices.location,
    geojson('{ "type": "Polygon", "coordinates": [...] }')
) = true
  AND status = 'active';
cr-quote-image

Hybrid location-aware intelligence

CrateDB is fully multi-model. Geospatial data sits in the same row as:

  • Time-series metrics
  • Text attributes
  • JSON metadata
  • Vector embeddings
  • Structured business data

This enables powerful hybrid queries that combine all modalities:

  • Geo + text ("assets in this zone mentioning 'battery warning'")
  • Geo + vectors (semantic search with proximity constraints)
  • Geo + metrics (temperature spikes in specific areas)
  • Geo + time (movement analysis within time windows)
All using standard SQL, without stitching multiple systems together.
cr-quote-image

Why CrateDB for geospatial workloads

CrateDB brings real-time, scalable, and intelligent geospatial analytics to any application or data architecture.
cr-quote-image
Talk
Fleet_Management
Optimizing E-Scooter Fleets with IoT and Real-Time Geospatial Analytics

This presentation from AI & Big Data Expo 2024 explores how CrateDB enables efficient management of e-scooter fleets across cities. Learn how real-time tracking, geospatial data, and diverse analytics streamline fleet operations, improve resource allocation, and solve urban mobility challenges.

Academy
geospatial
CrateDB Academy Lesson: "Geospatial Data"

In this lesson, you will learn why CrateDB excels at storing, analyzing, and tracking the location of people and objects in real time. Whether you're managing a fleet of vehicles, offering customers information about services near their location, or analyzing historical traffic patterns, CrateDB's geospatial data types and functions have you covered.

Academy
Would like to see an image with a developer doing an handson exercise on a laptop-1
Hands-on exercise

Spin up your CrateDB Cloud cluster and play around with some geospatial queries. Determine for example determine how many of each type of 311 call was made from an area close to the local airport.

Curious to learn more?

User stories

The GolfNow division of the NBC Universal GolfChannel is trusted by 4 million registered golfers to search for golf courses that fit preference and budget. They use CrateDB to currently perform real-time queries of more than 300 million rows of data, hundreds of times per second.

"CrateDB was a better solution for our needs than any other SQL or NoSQL database we tried. It was easy to migrate code off of our legacy SQL database and onto CrateDB to immediately benefit from its data flexibility and scalable performance."

Sheriff Mohamed
Director of Architecture
GolfNow

golfnow
Spatially Health is a provider of location intelligence software.They use CrateDB for their data scientists to find geographic insights through the patterns and relationships in their data by analyzing terabytes of data. They plan to scale CrateDB to handle hundreds of terabytes as it continues to expand to other cities.

"Postgres couldn't keep up with the data we have; Datastax Enterprise had ingest scaling issues with spatial data; Cassandra didn't have spatial query operations. CrateDB was the only database we found that could smoothly process data for our users and for our data science team. We fell in love with it immediately."

Kartik Venkatesh
CTO
Spatially Health

Spatially-Health
AVUXI provides location context for travel and real estate. They use CrateDB to collect and query geotagged data from over 65 million locations, processing over 20 million events every day.
 

"It is a pleasure working with companies like yours, that listen and care about their customers."

Avuxi

Clickdrive.io tracks automotive vehicle fleets in real-time. They use CrateDB to enable storage and analysis of up to 2,000 data points per second, per car.

"Most of the cars in our customers' fleets are in use almost 24 hours a day, and we need to store and analyse the massive amounts of data they generate in real time. We tried a few different SQL and NoSQL databases, and CrateDB offered the best combination of high performance, scalability and ease of use."

Clickdrive

Additional resources

Documentation

Geo data types

GEO_POINT, GEO_SHAPE

Documentation

Geo search

MATCH, intersects, within, distance

FAQ

Geospatial data represents specific geographical locations using latitude and longitude coordinates or text fields naming geographical areas like countries or states. This data is crucial for applications that require tracking and analyzing the location of people and objects. CrateDB supports the storage, analysis, and real-time tracking of geospatial data - all using SQL.

Spatial data encompasses various formats used to represent geographic locations and shapes. Common examples include arrays for simple point data and GeoJSON or WKT formats for more complex shapes. CrateDB supports these geospatial data types, offering flexibility and precision in storing and querying geospatial information.

Storing geospatial data efficiently requires a database with strong scalability due to the large volume of data points it generates. It should allow for the control of geographic index precision and resolution to enable faster query results and support exact queries with functions like intersects, within, and distance. CrateDB excels in this area by offering scalable SQL support for geospatial data types, including geo_point and geo_shape, making it ideal for geospatial applications.

The best databases for spatial data should offer advanced geospatial functions to handle spatial count, distance and overlap efficiently. Examples of databases optimized for spatial data include CrateDB, Amazon Aurora, Esri ArcGIS, and MariaDB. CrateDB supports robust geospatial capabilities, allowing for seamless integration and analysis of spatial data.

Geospatial analytics involves analyzing data that is tied to specific geographical locations, often represented through maps or spatial coordinates. Unlike traditional data analytics, which typically focuses on numerical or categorical data, geospatial analytics adds a locational context to data, allowing users to visualize and analyze spatial patterns, relationships, and trends. This added dimension enables more accurate decision-making in fields like urban planning, environmental monitoring, and transportation logistics.

Geospatial analytics is widely used across multiple industries, including:

  • Transportation and Logistics: For route optimization, fleet management, and tracking vehicles or assets in real-time.
  • Urban Planning and Smart Cities: To analyze land use, infrastructure, and traffic patterns, supporting sustainable urban growth.
  • Agriculture: To monitor crop health, manage resources, and optimize yields based on soil and climate data.
  • Energy and Utilities: For managing infrastructure, predicting demand, and optimizing energy distribution.
  • Retail and Real Estate: To analyze customer demographics and locations to improve marketing strategies and site selection.

Geospatial analytics relies on various types of data, including:

  • GPS and Satellite Data: Provides location information, often used for tracking and monitoring assets.
  • IoT Sensor Data: Used for real-time monitoring of infrastructure, vehicles, or environmental conditions in smart cities or logistics networks.
  • Geotagged Social Media Data: Captures user-generated content with location metadata, useful for real-time insights.
  • Demographic Data: Helps understand population distribution, income levels, and other societal factors in a geographic area.
  • Remote Sensing Sata: Involves the collection of data about the Earth’s surface from aircraft or satellites, often used in agriculture, environmental monitoring, and land use planning.

 

CrateDB manages geospatial data by providing native support for geographic data types, such as points, lines, and polygons. It allows users to store, query, and analyze geospatial data efficiently, leveraging SQL for easy querying. CrateDB supports geospatial indexing, enabling fast lookups and proximity searches. It also integrates with common geospatial standards like GeoJSON, making it compatible with a wide range of applications. Additionally, CrateDB’s scalability ensures that it can handle large datasets, making it suitable for real-time geospatial analytics across industries such as logistics, IoT, and smart city initiatives. More information here.