AI SQL Queries

Owl AI can generate, explain, and debug spatial SQL queries against your map datasets. Queries use PostGIS syntax and run directly against your data.

Writing a Query with AI

  1. Open Owl AI and type a question that requires data computation: "What is the average distance between hospitals and the nearest fire station?"
  2. Owl AI generates a PostGIS query, shows it in the SQL editor, and explains each part.
  3. Click Run to execute. Results appear as a new layer on the map or as a data table, depending on the output type.

SQL Editor

You can also write queries manually in the SQL editor (accessible via the Upload > SQL Query menu). The editor includes:

  • Schema browser showing all layers and their column names/types
  • Syntax highlighting and auto-complete for PostGIS functions
  • Query history
  • Explain plan visualization

Supported Functions

GISOwl supports the full PostGIS function library including geometry operations (ST_Buffer, ST_Intersection, ST_Union), measurements (ST_Distance, ST_Area, ST_Length), spatial relationships (ST_Contains, ST_Within, ST_Intersects, ST_DWithin), transformations (ST_Transform, ST_Centroid, ST_Simplify), and aggregations (ST_Collect, ST_ConvexHull, ST_Extent).

Saving Queries

Save frequently used queries to your workspace. Saved queries can be scheduled to refresh on an interval, creating live-updating derived layers.

Next Steps