Abstract:Text2SQL has evolved into a significant tool for data analysis and database management by reducing the technical barriers for non-expert users to interact with relational databases. The introduction of large language model (LLM), represented by GPT, further improves the performance of Text2SQL systems. However, existing Text2SQL techniques are difficult to apply directly to the spatial database domain because spatial data involves complex geometric relationships, diverse query types, and the demand for high-precision semantic understanding. To address these issues and lower the threshold for interaction between non-experts and spatial databases, a natural language query (NLQ) transformation method for spatial databases is proposed. The method consists of two core phases: (1) natural language understanding; (2) executable language generation. In phase (1), an entity information extraction algorithm is employed to extract key query entities, and a spatial data query corpus is constructed based on large language models to determine the query type. In phase (2), a structured language model (SLM) is selected according to the query type, and the entities are then mapped into the structured language model to generate the final executable language for spatial databases. Experimental results on multiple real-world datasets demonstrate that the proposed method enables efficient transformation from natural language queries to executable languages of spatial databases.