aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/data/parks-geojson.ts
blob: e12d297d6a09a9ca6126b45fd682ea52daaf366e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import osm from "./kodaira-parks-osm.json";
import manual from "./kodaira-parks-manual.json";

// OSMから取得したポリゴンと、QGIS等で手描きしたポリゴンをまとめる。
// 手描き分は kodaira-parks-manual.json に置くことで、npm run osm:update で消えない。
//
// 一覧にないグラウンド(校庭・運動場・pitch・recreation_ground)と、
// 名前のない小規模な地物は地図に出さない。
// 一覧にない公園・緑地のうち、名前のあるものだけを薄い赤で残す。
function isHiddenUnlisted(props: any): boolean {
  if (!props || props.matched || props.our_name) return false;
  const name = String(props.name || "").trim();
  const tag = String(props.leisure || props.landuse || "");
  if (!name) return true;
  if (/グラウンド|校庭|運動場/.test(name)) return true;
  if (tag === "pitch" || tag === "recreation_ground") return true;
  return false;
}

const osmFeatures = ((osm as any).features ?? []).filter(
  (f: any) => !isHiddenUnlisted(f.properties),
);
const features = [...osmFeatures, ...((manual as any).features ?? [])];

export default { type: "FeatureCollection", features };