Spatial dimension type: extending dimension with a spatial descriptor for geometry/geography and spatial index data #114
xavipereztr
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone!
Context
At CARTO we are building AI Agent-driven geospatial analytics on top of the leading cloud data warehouses (BigQuery, Snowflake, Databricks). We are currently implementing current OSI spec in production as the semantic layer for our AI Agents and have learned a lot about what information a consuming tool actually needs to work correctly with spatial data.
We opened a broader discussion on geospatial support in #69, covering spatial field types, spatial relationship predicates, and geographic hierarchies. This post focuses on the most immediately practical piece: a first-class spatial dimension type at the field level.
The problem
Today, a field containing a WKB polygon geometry and a field containing an H3 spatial index string are both indistinguishable from a regular string column in OSI. An LLM-powered agent, BI tool, or query engine has no way to know that one should be rendered as a polygon layer, that the other represents a hexagonal grid cell in a hierarchical spatial system at a specific resolution, or that neither should be treated as a free-text field.
A bare boolean flag analogous to
is_timewould be a step forward, but not enough. Spatial columns carry metadata that is critical for correct tool behaviour: the geometry type, the coordinate reference system, the spatial index system and resolution, and the geographic granularity level. Without these, an AI Agent will have to guess.This is directly related to the ongoing conversations in #25 and #17 about replacing
is_timewith a richerdimension_typeordatatypeenum, and to #55 on semantic field types. Our proposal is a concrete example of what a richer dimension type looks like in practice;spatialwould be one of those types, carrying the metadata object that consuming tools need.Proposal:
spatial_datadescriptor object insidedimensionWe propose adding a
spatial_dataobject within the existingdimensionblock. Its presence marks the field as a spatial dimension; its absence means the field is not spatial. All spatial sub-attributes live inside it, inherently scoped and only relevant for spatial fields.Example 1 — polygon geometry at census block group level
Example 2 — H3 spatial index at resolution 8
Why at the spec level, not
custom_extensionsWe are currently shipping this pattern through CARTO's
custom_extensions(vendor_name: CARTO) and it works. But we believe it belongs in the OSI core for three reasons:Symmetry with
is_time. The spec already treats time as a first-class dimension type. Spatial is equally fundamental and equally cross-industry — real estate, logistics, public health, retail, urban planning. It deserves the same treatment.The underlying standards are open and stable. Geometry types (
point,polygon,line) are OGC standards implemented by every major spatial database. H3, Quadbin, and Geohash are open-source and widely adopted. SRID codes follow the EPSG registry. None of this is vendor-specific.Interoperability requires a common vocabulary. If spatial semantics live only in vendor
custom_extensions, a tool consuming an OSI model from vendor A cannot understand the spatial metadata from vendor B — even if both describe the same H3 column identically. A spec-levelspatial_datadescriptor means any OSI-compliant consumer gains spatial awareness without vendor-specific knowledge.That said, if the community prefers to keep the core spec narrow, we are happy to publish the
spatial_datadescriptor as a documented CARTOcustom_extensionwith an open schema that others can adopt. We'd also be open to a two-layer approach: a minimal core (type+sridonly) promoted to spec now, with richer attributes (index,geographic_level,geographic_hierarchy) as an extension to promote later.We'd welcome feedback on the schema design and on where the right boundary is.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions