메뉴
HN
Hacker News 21일 전

GeoSQL: 지리공간 데이터 분석을 위한 AI 에이전트 스킬

IMP
7/10
핵심 요약

데이터 과학자와 분석가를 위해 개발된 GeoSQL은 Claude, Codex, GitHub Copilot 등 AI 에이전트와 연동되어 PostGIS, BigQuery 등의 지리공간(Geospatial) 데이터 처리를 돕는 도구입니다. 특히 AI가 텍스트만으로 오류를 찾던 기존 방식에서 벗어나, 지도를 직접 렌더링하여 시각적으로 결과를 검토하고 스스로 오류를 수정하게 함으로써 작업 효율과 정확도를 4배 향상시켰습니다. 별도의 SaaS 계정 없이 로컬 환경에서 100% 작동하며, 비용 초과 방지 및 쿼리 최적화 기능도 지원합니다.

번역된 본문

GeoSQL: Claude/Codex를 위한 지리공간 데이터 스킬

GeoSQL은 PostGIS, BigQuery, Snowflake, Wherobots에서 지리공간(Geospatial) 데이터를 다루는 데이터 과학자 및 분석가를 위해 설계된 Claude, Codex, GitHub Copilot 스킬(Skill)입니다.

참고: SaaS 계정이 필요하지 않습니다. 100% 로컬 또는 자체 호스팅 환경에서 작동합니다. '루프 내 지도(Map in the loop)' 기능을 통해 지리공간 작업의 효율을 4배 향상시킵니다.

빠른 시작 Python을 통한 빠른 시작(대화형 모드): pip install geosql && geosql

지원되는 에이전트에 직접 설치: geosql install claude geosql install codex geosql install copilot

또는 Claude Code에서: /plugin marketplace add dekart-xyz/geosql /plugin install geosql

geosql install copilot 설치 후, VS Code Copilot이나 Copilot CLI에서 다음과 같은 프롬프트로 GeoSQL을 사용할 수 있습니다: /geosql 주요 도로를 따라 전기차 충전소 밀도를 보여주고 지도를 렌더링해 줘

지도 렌더링 및 PostGIS 지원을 위한 Dekart 설치 GeoSQL은 선택적으로 Dekart를 사용합니다. Dekart는 PostGIS, BigQuery, Snowflake 연결을 지원하는 오픈소스 Kepler.gl 백엔드입니다. 하나의 도커 명령어로 로컬에서 실행하거나, 자체 인프라에 호스팅하거나, Dekart Cloud를 사용할 수 있습니다.

로컬에서 Dekart 실행 (Dekart Cloud를 사용하려면 이 단계를 건너뛰세요): docker run -p 8080:8080 dekartxyz/dekart

Dekart CLI 설치: pip install dekart && dekart init

CLI 및 Dekart 프롬프트를 따라 PostGIS, BigQuery, Snowflake 또는 Wherobots 데이터베이스를 연결하세요.

에이전트에서 사용해 볼 예시 프롬프트:

  • 부동산 분석: /geosql 오타와(Ottawa)에서 학교 접근성이 낮은 건물을 보여주고 지도로 렌더링해 줘
  • 입지 선정: /geosql POI(관심 장소) 동반 분포 및 가장 가까운 경쟁사까지의 거리를 기반으로 시애틀(Seattle)에 스포츠 용품점을 위한 상위 10개 입지를 찾아줘. 지도를 만들어 줘.
  • 전기차 충전 인프라: /geosql 루마니아 주요 도로를 따라 전기차 충전소 밀도 지도를 만들어 줘. 각 고속도로, 간선도로 또는 주요 도로 구간의 5km 이내에 충전소가 몇 개나 있는지 강조해 줘.

작동 방식 GeoSQL은 내부에 지도를 포함하는 에이전트 루프를 실행합니다.

  1. 탐색(Discovery): 이 스킬은 스키마를 추측하는 대신 데이터 웨어하우스의 메타데이터(테이블, 열, 유형)를 탐색합니다. BigQuery 및 Snowflake의 Overture Maps 공유 데이터와 PostGIS, BigQuery, Snowflake 또는 Wherobots의 프라이빗 테이블과 함께 작동합니다.
  2. SQL 작성: 에이전트는 사용 중인 엔진에 맞는 올바른 함수(ST_INTERSECTS, ST_DISTANCE, H3, 파티션 정리를 위한 bbox 오버랩 등)를 사용하여 공간 SQL(Spatial SQL)을 작성합니다.
  3. 비용 확인(Cost check): BigQuery에서는 모든 쿼리를 실행하기 전에 드라이 런(dry-run)하여 스캔할 데이터 용량을 추정합니다. 기본적으로 10GiB의 청구 한도가 적용됩니다. 예산이 초과되는 쿼리는 실행되는 대신 더 저렴한 방식(더 좁은 bbox, 더 낮은 H3 해상도, 더 많은 필터 등)으로 재작성됩니다.
  4. 지오메트리 검증(Geometry validation): 에이전트는 건전성 검사를 위해 전체 면적(다각형) 또는 전체 길이(선)를 계산하고, 도메인 지식과 교차 검증합니다.
  5. 지도 피드백(Map feedback): 가능한 경우 에이전트는 Dekart를 통해 결과를 렌더링하고, 렌더링된 이미지를 보면서 순수 텍스트 루프에서는 놓칠 수 있는 지오메트리 실수를 수정합니다. 이 과정이 바로 작업 효율을 4배 향상시키는 루프입니다.

이 스킬은 로컬 CLI 인증(bq, snow, dekart)을 사용하므로 웨어하우스 자격 증명은 에이전트로 전송되지 않습니다.

벤치마크 GeoSQL은 evals/ 경로에 재현 가능한 평가 테스트 세트를 제공합니다. 각 사례는 단순히 '에이전트가 대답했는가'를 넘어 특정 동작(비용 가드레일, 검증 단계, 올바른 결과)을 확인합니다. 현재 포함된 테스트 세트의 결과는 다음과 같습니다:

  • london-boroughs: 4개 어설션, 100% 통과율
  • berlin-create-map: 3개 어설션, 100% 통과율
  • paris-boundaries: 1개 어설션, 100% 통과율
  • 총합: 8개 어설션, 100% 통과율
  • 평균: 턴당 3,085개 토큰 사용, 턴당 72초 소요

위에서 언급된 4배 향상 차트는 동일한 작업 세트에 대해 '루프 내 지도(Map in-loop)' 단계가 있을 때와 없을 때를 비교한 것입니다. 지도가 없으면 에이전트의 텍스트 전용 검증은 지오메트리 클래스 오류(동네 다각형을 대도시권 경계로 착각, 겹치는 피처 이중 집계, 좌표 참조 시스템에서 잘못된 조인 키 선택 등)를 놓치게 됩니다. 렌더링된 지도를 도구 호출로 추가하면 에이전트가 이러한 실수를 시각적으로 인지하고 스스로 수정할 수 있습니다.

직접 테스트 세트를 실행해 보세요: python evals/run.py 설정 및 새로운 사례 추가 방법은 evals/RUNBOOK.md를 참조하세요. 새로운 평가 사례가 담긴 PR(Pull Request)도 환영합니다.

원문 보기
원문 보기 (영어)
GeoSQL Claude, Codex, and GitHub Copilot skill for data scientists and analysts working with geospatial data on PostGIS, BigQuery, Snowflake, and Wherobots. Note: No SaaS account needed. Works 100% locally or self-hosted. 4x improvement on geospatial tasks with map in the loop. Quick Start With Python (interactive mode): pip install geosql && geosql Install directly into a supported agent: geosql install claude geosql install codex geosql install copilot Or in Claude Code: /plugin marketplace add dekart-xyz/geosql /plugin install geosql After geosql install copilot , use GeoSQL from VS Code Copilot or Copilot CLI with prompts such as: /geosql Show EV charger density along major roads and render a map Install Dekart for map rendering and PostGIS support GeoSQL optionally uses Dekart : an open-source Kepler.gl backend with connectors for PostGIS, BigQuery, and Snowflake. You can run Dekart locally with one docker command, self-host it on your own infrastructure, or use Dekart Cloud. Run Dekart locally (skip this step to use Dekart Cloud ): docker run -p 8080:8080 dekartxyz/dekart Install the Dekart CLI: pip install dekart && dekart init Follow CLI and dekart prompts to connect your PostGIS, BigQuery, Snowflake or Wherobots database. Example prompts to try in your agent: Real estate analysis: /geosql Show buildings with low school accessibility in Ottawa, render as a map Site selection: /geosql Find the top 10 locations for Sporting Goods Store in Seattle based on POI co-location and distance to the nearest competitor. Create a map. EV charging infrastructure: /geosql create map EV charger density along major Romanian roads, highlighting how many charging stations are within 5 km of each motorway, trunk, or primary road segment. How it works GeoSQL runs an agent loop with a map in it. Discovery. The skill explores your warehouse metadata (tables, columns, types) instead of guessing schemas. Works with Overture Maps shares on BigQuery and Snowflake, and your private tables on PostGIS, BigQuery, Snowflake, or Wherobots. SQL. The agent writes spatial SQL using the right functions for your engine ( ST_INTERSECTS , ST_DISTANCE , H3, bbox overlap for partition pruning, and so on). Cost check. On BigQuery, every query is dry-run first to estimate bytes scanned. A 10 GiB billing cap is enforced by default. Over-budget queries get rewritten cheaper (tighter bbox, lower H3 resolution, more filters) instead of executed. Geometry validation. The agent computes total area (polygons) or total length (lines) as a sanity check, and cross-checks against domain knowledge. Map feedback. When available, the agent renders the result through Dekart, looks at the rendered image, and corrects geometry mistakes the text-only loop would miss. This is the loop that gets the 4x improvement. The skill uses your local CLI authentication ( bq , snow , dekart ), so warehouse credentials never go to the agent. Benchmarks GeoSQL ships with a reproducible eval suite under evals/ . Each case asserts specific behaviors (cost guardrails, validation steps, correct result), not just "did the agent answer." Current results on the included suite: Case Assertions Pass rate london-boroughs 4 100% berlin-create-map 3 100% paris-boundaries 1 100% Total 8 100% Average: 3,085 tokens per turn, 72 s duration per turn. The 4x improvement chart above compares the same task set with and without the map-in-loop step. Without maps, the agent's text-only validation misses geometry-class errors (mistaking a neighborhood polygon for a metro-area perimeter, double-counting overlapping features, picking the wrong join key on coordinate-reference systems). Adding the rendered map as a tool call lets the agent see those mistakes and self-correct. Run the suite yourself: python evals/run.py See evals/RUNBOOK.md for setup and how to add new cases. PRs with new evals welcome.