aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/update-nearby-parks.py
diff options
context:
space:
mode:
authorYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-25 21:29:16 +0900
committerYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-25 21:29:16 +0900
commitfa73b6a9f36268986af68192f65978539f4d059c (patch)
tree6a4f27d54823d35da29f68ef37b93bba37f71cf2 /scripts/update-nearby-parks.py
parenta01062f43d36112c00d5c007ac9d488c14d8fb0d (diff)
parks: シェルター等の統合と編集画面の刷新
パーゴラ・東屋を「シェルター等」に統合し、編集画面に確認チェック・遊具別入力・時計・選択行ハイライトを追加した。周辺公園と周辺施設の自治体名を補完し、公園データの文字化けを修正した。
Diffstat (limited to 'scripts/update-nearby-parks.py')
-rw-r--r--scripts/update-nearby-parks.py43
1 files changed, 42 insertions, 1 deletions
diff --git a/scripts/update-nearby-parks.py b/scripts/update-nearby-parks.py
index ef30f53..9f30e00 100644
--- a/scripts/update-nearby-parks.py
+++ b/scripts/update-nearby-parks.py
@@ -323,6 +323,42 @@ def existing_keys():
}
+def existing_cities():
+ """前回の出力に手動で補完した city を保持する。"""
+ if not os.path.exists(OUT):
+ return {}
+ try:
+ data = json.load(open(OUT, encoding="utf-8"))
+ except (OSError, ValueError):
+ return {}
+ result = {}
+ for feature in data.get("features", []):
+ props = feature.get("properties") or {}
+ key = (props.get("osm_type"), props.get("osm_id"))
+ city = (props.get("city") or "").strip()
+ if city:
+ result[key] = city
+ return result
+
+
+def existing_clocks():
+ """前回の出力に手動で入れた時計情報を保持する。"""
+ if not os.path.exists(OUT):
+ return {}
+ try:
+ data = json.load(open(OUT, encoding="utf-8"))
+ except (OSError, ValueError):
+ return {}
+ result = {}
+ for feature in data.get("features", []):
+ props = feature.get("properties") or {}
+ key = (props.get("osm_type"), props.get("osm_id"))
+ clock = (props.get("時計") or "").strip()
+ if clock:
+ result[key] = clock
+ return result
+
+
def exclusion_polygons():
"""近隣公園から除外する大きな公園のポリゴン(経緯度)。
@@ -483,6 +519,8 @@ def main():
boundary = BoundaryIndex(boundary_xy)
skip = existing_keys()
+ city_by_key = existing_cities()
+ clock_by_key = existing_clocks()
exclusions = exclusion_polygons()
features = []
skipped_inside = 0
@@ -555,9 +593,11 @@ def main():
"area_m2": int(round(area)),
"osm_type": el.get("type"),
"osm_id": el.get("id"),
- "city": (tags.get("addr:city") or "").strip(),
+ "city": (tags.get("addr:city") or "").strip()
+ or city_by_key.get((el.get("type"), el.get("id")), ""),
"note": NOTE,
"name_source": name_source,
+ "時計": clock_by_key.get((el.get("type"), el.get("id")), ""),
},
"geometry": geojson_geometry(polygons_ll),
}
@@ -579,6 +619,7 @@ def main():
"city": manual["city"],
"note": manual["note"],
"name_source": "manual",
+ "時計": clock_by_key.get((manual["osm_type"], manual["osm_id"]), ""),
},
"geometry": {
"type": "Point",