As spatiotemporal data grows in complexity, utilizing geospatial modeling on the Google Earth Engine (GEE) platform poses challenges in improving coding efficiency for experts and enhancing the coding capabilities of interdisciplinary users. To address these challenges, we propose a framework for constructing a geospatial operator knowledge base tailored to the GEE JavaScript API. The framework includes an operator syntax knowledge table, an operator relationship frequency knowledge table, an operator frequent pattern knowledge table, and an operator relationship chain knowledge table. Leveraging Abstract Syntax Tree (AST) techniques and frequent itemset mining, we extract operator knowledge from 295,943 real GEE scripts and syntax documentation, forming a structured knowledge base. Experimental results demonstrate that the proposed framework achieves an accuracy ranging from 87% to 93% in operator relationship extraction tasks, measured by accuracy, recall, and F1 score metrics. In operator relationship chain extraction tasks, the framework achieves a performance range of 0.79 to 0.89 across LCS, Ngram, Siamese, and BERT-based evaluations. In geospatial code generation tasks, GEE-OPs improves the executability of mainstream Large Language Models (LLMs) by 38.0% to 44.9%, enhances correctness by 24.1% to 47.2%, and boosts readability by 4.7% to 7.6%. Ablation experiments further validate the essential role of each knowledge table in enhancing model performance. Additionally, key performance indicators – including response time, lines of code, token consumption, and memory usage – are documented to assist readers in replicating the experiments and gaining deeper insights into system performance. This work advances geospatial code modeling techniques and facilitates the application of LLMs in geoinformatics, contributing to the integration of generative AI into the field.
- Article type
- Year
Open Access
Article
Issue
Open Access
Article
Issue
While leveraging large language models (LLMs) for intelligent geospatial modeling has garnered significant attention, the limited domain-specific knowledge of LLMs often leads to inefficient or unreliable geo-analysis model generation. Crowdsourced geoprocessing scripts encapsulate extensive expert knowledge for different geospatial modeling tasks, where code snippets are strategically combined into functional steps to build application-specific modeling processes. However, extracting these modeling processes from heterogeneous geoprocessing scripts and integrating them for reuse remains challenging due to the complexity of code interdependencies, the heterogeneity of scripting approaches, and the need for domain-specific customization. To address this, we propose S-GMKG, a knowledge graph that systematically extracts and integrates modeling processes from scripts as structured semantic units. Two strategies are introduced: a skeleton-based extraction method and a knowledge-enhanced chain of thought (CoT) approach, which facilitate automated modeling process extraction for S-GMKG via prompt engineering. Furthermore, a self-canonicalization and knowledge augmentation process is proposed to refine the S-GMKG. Consequently, S-GMKG serves as a robust external knowledge source to provide interpretable, graph-based modeling solutions and synergizes with LLMs for geospatial tasks. We implemented the S-GMKG using 4820 geoprocessing scripts and evaluated it across various LLMs. Results indicate that most scripts in the S-GMKG can be represented as modeling processes with 3–7 functional steps, with the proposed strategies achieving 3.2%–14.5% higher recall rates in relationship identification for these functional steps. Case studies in two distinct scenarios demonstrate the practicality of S-GMKG, particularly in collaborating with LLMs to generate code for geospatial modeling.
京公网安备11010802044758号