A Hands-On Guide for Working with Large-Scale Spatial Data. Learn more.
Authors
A semantic layer is a shared set of definitions that sits between data tables and the tools people use to ask questions. It names each business term once, such as revenue or active customer, and says how to compute it. A dashboard, a spreadsheet and an AI agent then give the same answer. This article tests a claim: for location data, a semantic layer must also set spatial rules, such as which boundary and which distance count. The Chicago test below changes six choices, one at a time: category, boundary, stop type, confidence score, distance, and a walk or a straight line.
How many restaurants are near transit in Chicago? Wherobots counted 7,464 restaurant records on October 26, 2026, within 1 km in a straight line of a rail station inside the city limits. Changing one of those choices at a time moved that count by as much as 68%. The counts are records in Overture Maps, an open map dataset of places, not restaurants checked on the ground.
Adding seven food and drink categories to the restaurant category raised the count 68%, to 12,534. Counting the metro area in place of the city limits raised it 48%, to 11,050. Measuring a 1 km walk in place of a 1 km straight line lowered it 9%, to 6,793.
A semantic layer maps business language to data in a database, which is queried with SQL (Structured Query Language). A metric is a calculated value, such as total sales. A dimension is an attribute used to group or filter results, such as region or product. The semantic layer records each one, along with the tables, joins and filters that compute them. A user or a tool requests "sales by region", and the semantic layer generates the SQL.
A semantic layer keeps numbers consistent. Without one, each team writes its own SQL. Two teams then report different numbers for the same term, and nobody can tell which one is right. Snowflake's announcement of Apache Ossie, an open project to share semantic definitions between tools, gives an example: monthly active users "is often defined inconsistently" (Snowflake's announcement of the new name).
A semantic layer usually holds four kinds of definitions:
A semantic layer turns a request into SQL. The request names metrics and dimensions. The semantic layer software looks up their definitions, adds the joins and filters, and sends the SQL to the database that holds the data. That database can be a data warehouse or a lakehouse, a store of data files that can be queried like a warehouse. The result comes back computed the same way every time.
The definitions are stored in files or in the database's catalog, and changes are often tracked like code. Some products turn them into SQL views, saved queries that work like tables. Others run their own service that business intelligence (BI) tools and AI agents send requests to.
Current examples:
The idea of separating what users ask from how data is stored is older than the name. Edgar Codd's relational model (Communications of the ACM, 1970) aimed to free users of large shared data banks from knowing how the data was organized in the machine. A study group of the American National Standards Institute (ANSI) followed with the ANSI/X3/SPARC framework, reported by Dennis Tsichritzis and Anthony Klug in 1978. It described three levels of schema, a schema being a description of how data is organized. An external view serves each group of users, a conceptual schema covers the whole organization, and an internal schema covers storage.
Business Objects, a software company, brought the idea to business users. Jean-Michel Cambot and Bernard Liautaud filed a patent in 1991 for a relational database access system using semantically dynamic objects, granted in 1996 as US 5,555,403. The Business Objects "universe" let users pick business terms, and the software generated the SQL. SAP, which now sells BusinessObjects, still describes the universe as the BusinessObjects semantic layer.
Data warehouse design added shared dimensions. In the Kimball Group's method, conformed dimensions mean the same thing in every table that uses them. A "store" or "date" can then be compared across tables about sales, inventory and other parts of the business. The method is set out in The Data Warehouse Toolkit, by Ralph Kimball and Margy Ross, 3rd edition, 2013.
Today the definitions also live inside data platforms, in products such as dbt, Databricks and Snowflake. In 2025, Snowflake, Salesforce, dbt Labs and other companies announced the Open Semantic Interchange. Their announcement describes it as "a common, vendor-neutral semantic model specification that standardizes how semantic metadata is defined and shared" (Snowflake press release). In July 2026, Snowflake announced that the project had been accepted into the Apache Incubator as Apache Ossie. The Apache Incubator is where the Apache Software Foundation starts new open source projects.
A retail company defines "net revenue" once as the sum of order totals, minus refunds, in the reporting currency, by order date. Finance, marketing and the AI assistant on the sales team all get the same figure for last quarter.
A transit agency defines "riders near a station" once. It counts people whose home census block, the smallest area the Census counts, has its center within a set walking distance of a station entrance. Every planning study then counts riders the same way.
A delivery company defines "restaurants near transit" for a city, which needs the spatial rules tested in Chicago below.
These terms overlap:
Language models learn from large amounts of public text. That text does not include how one company defines an active customer or which table holds it. A semantic layer supplies that definition. An AI agent then requests the metric by name, and the semantic layer generates the SQL.
Juan Sequeda, Dean Allemang and Bryon Jacob of data.world, a company that sells a data catalog, built a benchmark of questions about a database in the insurance domain (arXiv, 2023). With questions sent straight against the SQL tables, OpenAI's GPT-4 language model "achieves an accuracy of 16%". With the same questions asked over a knowledge graph built on the same database, "this accuracy increases to 54%".
The study is a preprint, a paper not yet reviewed by outside experts, written by a company that sells in this field. It tested a knowledge graph, not a semantic layer, on one benchmark.
The examples above define metrics and dimensions as columns in a table. A location metric also depends on choices that no column records. Each choice below has more than one defensible answer. The Chicago test below measured how the boundary, distance, transit and category choices change a count.
A city can mean its legal limits or its metropolitan area. The US Office of Management and Budget (OMB) defines a metropolitan statistical area as a core urban area plus the counties tied to it (OMB Bulletin 23-01). For Chicago, that area reaches into Indiana.
Statisticians have known since 1934 that changing the areas used to group data changes the results (Gehlke and Biehl, Journal of the American Statistical Association). This is the modifiable areal unit problem, studied at length by Fotheringham and Wong (Environment and Planning A, 1991).
Spatial databases follow the Open Geospatial Consortium (OGC) Simple Features standard, also published by the International Organization for Standardization (ISO) as ISO 19125-1. It defines spatial tests such as "within" and "intersects" with a matrix of how two shapes' insides, edges and outsides meet. The matrix comes from work by Egenhofer and Franzosa (1991) and Clementini, Di Felice and van Oosterom (1993).
Under that standard, a point on a boundary line is not "within" the area, as the documentation for PostGIS, a widely used spatial database, shows. A restaurant on a city line counts as inside under "intersects" and outside under "within".
A circle drawn around a point and an area traced along the street network cover different ground. Lisa Oliver, Nadine Schuurman and Alexander Hall compared circular and street network areas (International Journal of Health Geographics, 2007). Javier Gutiérrez and Juan Carlos García-Palomares measured how the distance measure changes the area a transit stop serves (2008).
In Wherobots, the distance test ST_DWithin uses the units of the data's coordinate system by default. On longitude and latitude data, a distance of 1,000 means 1,000 degrees.
Transit planning often uses half a mile. The Federal Transit Administration (FTA) treats pedestrian improvements within one half mile of a stop or station as related to transit for funding (FTA policy, 2011). A study of 1,449 stations in 21 US cities supported a half-mile area around each station for counting the people it serves. The study found support for "a 0.5-mile catchment area for population" (Guerra, Cervero and Tischler, 2012).
Measured walks can be shorter. In Montreal, 85% of walks from home to bus service were about 524 m or shorter (El-Geneidy and others, 2014).
A coordinate reference system is the grid that ties numbers to places on Earth and sets their units. Data from different publishers can use different ones. US Census boundaries use NAD 83, the North American Datum of 1983. Overture Maps uses WGS 84, the World Geodetic System 1984. A semantic layer should record which coordinate reference system every metric uses, and convert the data to it before measuring.
Point of interest data, map records of businesses and other places, labels each place with a category. Overture Maps sorts places into a list of "roughly 2,300 categories". Each place also has a confidence score, "a value between 0 and 1 representing the likelihood that the place exists" (Overture places guide). Whether a café or a bar counts as a restaurant, and which minimum confidence score to require, are business decisions. See point of interest data for how these datasets are built.
The test asked one question about Chicago: how many restaurants are near transit? The definitions varied what "restaurant", "Chicago", "transit" and "near" mean. The claim holds if definitions a team could defend change the answer by more than 5%, and fails if they agree within 5%.
The data came from open sources, all queried in Wherobots on October 26, 2026:
An isoline is a line of equal value. HERE's service draws one at a set travel time or a set travel distance. An isoline of equal travel time is an isochrone. These walking areas use distance: 805 m and 1,000 m on foot.
One query computed every count in 19 seconds. The two shorter queries below reproduce six of them.
The base definition has five rules. A place has Overture's restaurant category. Its confidence score is 0.5 or more. It sits inside or on the city limits (the query uses "intersects"). It lies within 1 km in a straight line of a rail station.
Distances were measured in meters after converting the data to Universal Transverse Mercator (UTM) zone 16N, a grid in meters for this part of the United States. The test changed one choice at a time.
This query computes four of the counts at once. It runs as printed on Wherobots Cloud:
-- Restaurants near rail stations in Chicago, counted under four definitions WITH city AS ( SELECT ST_SubDivideExplode(geometry, 200) AS g FROM wherobots_open_data.overture_maps_foundation.divisions_division_area WHERE country = 'US' AND region = 'US-IL' AND subtype = 'locality' AND names.primary = 'Chicago' ), places AS ( SELECT id, basic_category, taxonomy.primary AS category, confidence, geometry, ST_Transform(geometry, 'EPSG:4326', 'EPSG:26916') AS geom_m -- meters, UTM zone 16N FROM wherobots_open_data.overture_maps_foundation.places_place WHERE bbox.xmin > -87.97 AND bbox.xmax < -87.50 AND bbox.ymin > 41.62 AND bbox.ymax < 42.04 ), rail AS ( SELECT geom_m FROM places WHERE basic_category IN ('public_transit_facility_or_service', 'train_station') AND category IN ('train_station', 'metro_station', 'light_rail_and_subway_stations', 'subway_station') ), eat AS ( SELECT DISTINCT p.id, p.basic_category, p.confidence, p.geometry, p.geom_m FROM places p JOIN city c ON ST_Intersects(c.g, p.geometry) WHERE p.basic_category IN ('restaurant', 'fast_food_restaurant', 'cafe', 'coffee_shop', 'bar', 'casual_eatery', 'food_truck_stand', 'smoothie_juice_bar') ), nearest AS ( SELECT e.id, MIN(ST_Distance(e.geom_m, r.geom_m)) AS meters FROM eat e JOIN rail r ON ST_DWithin(e.geom_m, r.geom_m, 1000) GROUP BY e.id ) SELECT COUNT_IF(e.basic_category = 'restaurant' AND e.confidence >= 0.5 AND n.meters <= 1000) AS restaurants_1km, COUNT_IF(e.basic_category = 'restaurant' AND e.confidence >= 0.5 AND n.meters <= 805) AS restaurants_half_mile, COUNT_IF(e.basic_category = 'restaurant' AND n.meters <= 1000) AS restaurants_1km_any_confidence, COUNT_IF(e.confidence >= 0.5 AND n.meters <= 1000) AS food_and_drink_1km FROM eat e JOIN nearest n ON e.id = n.id
It returns 7,464 restaurants within 1 km and 6,638 within half a mile. Keeping records with a confidence score below 0.5 gives 7,779. Counting all eight food and drink categories in the query gives 12,534.
The walking counts reuse the eat step. To run them, save the city, places and eat steps above as a temporary view named eat. The HERE walking areas sit in a table named walk, with one row per station and distance: the distance in meters (rng) and the area's shape (g). This query replaces the straight-line test with a test of whether a place falls inside a walking area:
eat
city
places
walk
rng
g
-- First: CREATE OR REPLACE TEMPORARY VIEW eat AS WITH city AS (...), places AS (...) SELECT ... (the eat step above) SELECT COUNT_IF(wmin <= 1000) AS restaurants_1km_walk, COUNT_IF(wmin <= 805) AS restaurants_half_mile_walk FROM ( SELECT e.id, MIN(w.rng) AS wmin FROM eat e JOIN walk w ON ST_Intersects(w.g, e.geometry) WHERE e.basic_category = 'restaurant' AND e.confidence >= 0.5 GROUP BY e.id )
It returns 6,793 restaurants within a 1 km walk and 5,749 within a half-mile walk.
With the base definition, 7,464 restaurants sit within 1 km in a straight line of a rail station. Changing one choice at a time gave these counts:
With the distance held at 1 km in a straight line, the count ranges from 7,464 with the base rules to 24,065 with four rules changed together. Those four are all eight food and drink categories, records at any confidence score, any transit stop Overture lists and the metro area. The high count is 3.2 times the base count.
The walking areas come from HERE and cover only stations in or near the city. So the walking comparison stays inside the city: 7,464 in a straight line against 6,793 on foot.
An earlier version of this article set a half-mile walk against a 1 km straight line. This version compares counts only when they use the same distance measure.
The claim holds: five of the six single changes moved the count by more than 5%. The confidence score, at 4%, was the one that did not.
Around Clark/Lake station in the Loop, Chicago's downtown, the 1 km walking area is 38% smaller than the 1 km circle and holds 32% fewer restaurants. The circle covers 3.14 km² and holds 974 restaurants. The walking area covers 1.94 km² and holds 665.
Across the city, the walk lowered the count by 9%, from 7,464 to 6,793, against 32% at Clark/Lake.
Three limits apply:
Each choice the test varied can be written down once:
In Wherobots, these rules can be stored as SQL views, saved queries that work like tables. The same approach fits the medallion architecture for geospatial data, a pattern of raw, cleaned and business-ready tables. A view named for the metric holds the boundary, the spatial test, the distance and the categories. Every dashboard, notebook and AI agent then queries the view.
An AI agent can run the same queries through MCP (Model Context Protocol), a standard way for agents to call tools. See the Wherobots MCP server and agent tools.
The metro-wide query in this article measured 45,748 food and drink records against transit stops and two boundaries in 19 seconds.
Jia Yu, Jinxuan Wu and Mohamed Sarwat introduced GeoSpark at the ACM SIGSPATIAL conference in 2015. The work grew into Apache Sedona, described in Spatial data management in Apache Spark: the GeoSpark perspective and beyond (GeoInformatica, 2019). Wherobots builds on that engine. A spatial join, which matches records by location, is the operation behind every count in this article.
Research on semantic layers and language models is newer. Dean Allemang and Juan Sequeda followed their benchmark with a study on using ontologies to check and repair answers (arXiv, 2024). Both are vendor preprints. We found few peer-reviewed tests of semantic layers for spatial questions, which is one reason this article runs its test on open data and prints its queries.
Run the Chicago query with a Wherobots free trial at cloud.wherobots.com.
A semantic layer is a shared set of definitions that sits between your data tables and the tools people use to ask questions. It says what each business term means, such as revenue or active customer, and how to compute it from the tables. A dashboard, a spreadsheet and an AI agent that all go through it get the same number for the same question.
Databricks is a data platform. It includes a semantic layer feature called metric views, stored in Unity Catalog, the Databricks catalog that records each table and who may use it. A metric view stores a metric’s definition once, so queries and dashboards on Databricks compute it the same way. Snowflake offers a similar feature called semantic views.
ETL (extract, transform, load) moves and cleans data into a data warehouse. The semantic layer comes after it. ETL sets what the stored tables contain. The semantic layer records what each business term means when someone queries those tables, such as which records count as a restaurant and which boundary counts as the city.
An ontology is a formal model of the kinds of things in a domain and how they relate, such as a place located in a building. A semantic layer is narrower and tied to queries. It maps business terms and metrics to tables and the SQL (Structured Query Language) code that computes them. Many teams build a semantic layer for metrics and use an ontology to describe the entities behind them.
A semantic layer fixes the meaning of metrics and terms for queries. A context layer, or context engine, gathers everything an AI system needs to answer a question. That can include those definitions plus documents, entity records, locations and recent events. Data about real places, such as stores, roads and city boundaries, also needs spatial rules in that context. They set which boundary, which distance and what counts as inside.
A data warehouse stores the data and runs the queries. A semantic layer stores definitions about that data: names, metrics, joins and access rules. When someone asks for restaurants within 1 km of a rail station, the semantic layer generates the SQL (database query) code, and the warehouse runs it.
dbt is a tool that turns SQL files into tables in a data warehouse. The dbt Semantic Layer lets teams define metrics in those files and query them from other tools. It runs on MetricFlow, software that turns metric definitions into SQL. dbt Labs agreed in 2023 to acquire Transform, the company that built MetricFlow.
What is a Kelvin Wave? Speed, El Niño and 2026 Data
A Kelvin wave is a long, low ocean wave that carries warm water east along the equator in an El Niño. In the 30 days to 10 November 2026, the sea at San Diego stood a record 41.2 cm above NOAA's tide prediction.
What Is an ETL Pipeline? Steps, Examples and Spatial ETL
An ETL (extract, transform, load) pipeline moves data from sources into storage. Learn the steps with examples. Then see a spatial mistake that passed the usual checks: rounding coordinates emptied 27% of Denver's building outlines.
What is an MCP Server? Spatial Context for AI Agents
An MCP server gives AI agents tools to call. With no tools, Claude Code gave no count of San Francisco's buildings. Via Wherobots MCP, it counted 162,538.
share this article
Awesome that you’d like to share our articles. Where would you like to share it to: