A-SW Hub / Repositories
Local Gitea · READ ONLY
← 저장소 Repositories
REPOSITORY

jbnu/spatial-information-db Private

[참조 MVP] 농경지 공간정보 DB — 농경지·장애물 GeoJSON 피처를 경계상자 기준으로 검색하는 경량 저장 모델입니다.

https://git.agrithing.ai/jbnu/spatial-information-db.git
6 commits
COMMIT DETAIL

feat: add executable reference MVP

A-SW Reference Factory <[email protected]> · 2026. 8. 2. 오전 7:38:04
68d8ce2503c3a5069e1fea5065a71f6b085e20f6
5 changed files +51 −0 parent ff0d18b
added asw_component/__init__.py +3−0 View file
@@ -0,0 +1,3 @@
1 + from .component import execute
2 +
3 + __all__ = ["execute"]
added asw_component/component.py +8−0 View file
@@ -0,0 +1,8 @@
1 + from __future__ import annotations
2 +
3 + def execute(payload: dict) -> dict:
4 + xmin, ymin, xmax, ymax = map(float, payload["bbox"])
5 + if xmin > xmax or ymin > ymax:
6 + raise ValueError("invalid bbox")
7 + matches = [feature for feature in payload.get("features", []) if xmin <= float(feature["x"]) <= xmax and ymin <= float(feature["y"]) <= ymax]
8 + return {"type": "FeatureCollection", "count": len(matches), "features": [{"type": "Feature", "id": item["id"], "properties": {"feature_type": item["type"]}, "geometry": {"type": "Point", "coordinates": [item["x"], item["y"]]}} for item in matches]}
added examples/input.json +22−0 View file
@@ -0,0 +1,22 @@
1 + {
2 + "bbox": [
3 + 0,
4 + 0,
5 + 10,
6 + 10
7 + ],
8 + "features": [
9 + {
10 + "id": "field-1",
11 + "type": "field",
12 + "x": 5,
13 + "y": 4
14 + },
15 + {
16 + "id": "tree-9",
17 + "type": "obstacle",
18 + "x": 15,
19 + "y": 12
20 + }
21 + ]
22 + }
added pyproject.toml +8−0 View file
@@ -0,0 +1,8 @@
1 + [project]
2 + name = "spatial_information_db"
3 + version = "0.1.0"
4 + description = "농경지·장애물 GeoJSON 피처를 경계상자 기준으로 검색하는 경량 저장 모델입니다."
5 + requires-python = ">=3.11"
6 +
7 + [tool.unittest]
8 + test-path = "tests"
added run.py +10−0 View file
@@ -0,0 +1,10 @@
1 + from __future__ import annotations
2 + import json
3 + import sys
4 + from asw_component import execute
5 +
6 + if __name__ == "__main__":
7 + path = sys.argv[1] if len(sys.argv) > 1 else None
8 + with open(path, encoding="utf-8") if path else sys.stdin as source:
9 + payload = json.load(source)
10 + print(json.dumps(execute(payload), ensure_ascii=False, indent=2))