GPT-Based Text-to-SQL for Spatial Databases

Text-to-SQL for spatial databases enables the translation of natural language questions into corresponding SQL queries, allowing non-experts to easily access spatial data, which has gained increasing attention from researchers. Previous research has primarily focused on rule-based methods. However, these methods have limitations when dealing with complicated or unknown natural language questions. While advanced machine learning models can be trained, they typically require large labeled training datasets, which are severely lacking for spatial databases. Recently, Generative Pre-Trained Transformer (GPT) models have emerged as a promising paradigm for Text-to-SQL tasks in relational databases, driven by carefully designed prompts. In response to the severe lack of datasets for spatial databases, we have created a publicly available dataset that supports both English and Chinese. Furthermore, we propose a GPT-based method to construct prompts for spatial databases, which incorporates geographic and spatial database knowledge into the prompts and requires only a small number of training samples, such as 1, 3, or 5 examples. Extensive experiments demonstrate that incorporating geographic and spatial database knowledge into prompts improves the accuracy of Text-to-SQL tasks for spatial databases. Our proposed method can help non-experts access spatial databases more easily and conveniently.

Authors

Institutions

Publication Details

Journal
ISPRS International Journal of Geo-Information
Published
2025-07-24
DOI
https://doi.org/10.3390/ijgi14080288
Citations
2
Primary Topic
Data Management and Algorithms
Type
article
Field-Weighted Citation Impact
2.97
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

GPT-Based Text-to-SQL for Spatial Databases

Jiajin Huang, Li Guo, Hui Wang, Yubin Liang et al.
2 citations
ISPRS International Journal of Geo-Information
Data Management and Algorithms
2.97
article

GPT-Based Text-to-SQL for Spatial Databases

Jiajin Huang, Li Guo, Hui Wang, Yubin Liang, L. D. Liu
article en
2 citations

Abstract

Text-to-SQL for spatial databases enables the translation of natural language questions into corresponding SQL queries, allowing non-experts to easily access spatial data, which has gained increasing attention from researchers. Previous research has primarily focused on rule-based methods. However, these methods have limitations when dealing with complicated or unknown natural language questions. While advanced machine learning models can be trained, they typically require large labeled training datasets, which are severely lacking for spatial databases. Recently, Generative Pre-Trained Transformer (GPT) models have emerged as a promising paradigm for Text-to-SQL tasks in relational databases, driven by carefully designed prompts. In response to the severe lack of datasets for spatial databases, we have created a publicly available dataset that supports both English and Chinese. Furthermore, we propose a GPT-based method to construct prompts for spatial databases, which incorporates geographic and spatial database knowledge into the prompts and requires only a small number of training samples, such as 1, 3, or 5 examples. Extensive experiments demonstrate that incorporating geographic and spatial database knowledge into prompts improves the accuracy of Text-to-SQL tasks for spatial databases. Our proposed method can help non-experts access spatial databases more easily and conveniently.

ISPRS International Journal of Geo-InformationVol. 14(8)
Tianjin Normal University (CN), PLA Information Engineering University (CN), Tianjin Foreign Studies University (CN), Beijing University of Technology (CN)
Openalex Percentile: Top 8%
Data Management and Algorithms
2.97
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

GPT-Based Text-to-SQL for Spatial Databases — Jiajin Huang, Li Guo, et al. · ISPRS International Journal of Geo-Information (2025) | TGRS Research Map | TGRS