Geospatial Data
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:
- High-throughput ingestion for real-time GPS and telemetry streams
- Sub-second queries across billions of data points
- Horizontal scalability for growing fleets, sensors, or geospatial datasets
- Real-time indexing for instant queryability after ingestion
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”
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.)
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
Geospatial functions & spatial analytics
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 locationSELECT id, status, last_seenFROM scootersWHERE distance(scooters.position, [7.4474, 46.9480]) < 200;-- Count active devices inside a city boundarySELECT count(*)FROM devicesWHERE within( devices.location, geojson('{ "type": "Polygon", "coordinates": [...] }')) = true AND status = 'active';
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)
Why CrateDB for geospatial workloads
- Real-time ingestion of millions of coordinates per second
- Instant queryability through real-time indexing
- Horizontally scalable architecture for large fleets and sensor networks
- Distributed SQL execution for heavy computational workloads
- Automatic indexing for geospatial types
- Columnar storage for ultra-fast analytics
- Simple SQL interface, no proprietary GIS language
- Native support for vectors, text search, JSON, and structured data
Curious to learn more?
User stories
"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
"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
"It is a pleasure working with companies like yours, that listen and care about their customers."
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."
Related blog posts
Geometric Shapes Indexing with BKD-trees
2024-03-26We are thrilled to announce that in CrateDB version 5.6.0, we introduced a BKD-tree-based indexing strategy for geometric shapes. In this blog post, we delve into the significance of this addition. ...
Best Database for Geospatial Data
2024-02-29Geospatial data is a type of information that describes objects or events with a specific location on or near the surface of the Earth. It combines location information and attribute information with ...
What is Geospatial Data?
2024-02-20Geospatial data is a type of information that describes objects or events with a specific location on or near the surface of the Earth. It combines location information and attribute information with ...
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.