From fa73b6a9f36268986af68192f65978539f4d059c Mon Sep 17 00:00:00 2001 From: Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> Date: Sun, 25 Oct 2026 21:29:16 +0900 Subject: parks: シェルター等の統合と編集画面の刷新 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit パーゴラ・東屋を「シェルター等」に統合し、編集画面に確認チェック・遊具別入力・時計・選択行ハイライトを追加した。周辺公園と周辺施設の自治体名を補完し、公園データの文字化けを修正した。 --- scripts/update-nearby-parks.py | 43 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'scripts/update-nearby-parks.py') 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", -- cgit v1.3.1