OpenWeatherMap の City ID から日本のものを抽出する

[OpenWeatheMap](https://openweathermap.org/)に登録されている City ID から 日本のものを抽出してみました。

入力データ
>city.list.json

抽出プログラム

```js:read_city.js
#! /usr/bin/node
// ---------------------------------------------------------------
//	read_city.js
//
//					May/03/2018
//
// ---------------------------------------------------------------
var fs = require("fs")
// ---------------------------------------------------------------
function sort_proc(array_in)
{
	array_in.sort(function(a,b){
		if(a.name < b.name)
			{
			return -1
			}
		else if(a.name > b.name)
			{
			return 1
			}
		else
			{
			return 0
			}
		})
}

// ---------------------------------------------------------------
function pick_up_proc(array_aa)
{
	var nn_jp = 0
	array_out = []
	array_aa.forEach(function(city)
		{
		if (city.country == "JP")
			{
			nn_jp += 1
			array_out.push(city)
			}
		})

	console.error("nn_jp = " + nn_jp)

	return	array_out
}

// ---------------------------------------------------------------
function out_proc(array_out)
{
	array_out.forEach(function(city)
		{
		var str_out = ""
		str_out += city.name + "\t" + city.id + "\t"
		str_out += city.coord.lat.toFixed(2) + "\t"
		str_out += city.coord.lon.toFixed(2)
		console.log(str_out)
		})
}

// ---------------------------------------------------------------
console.error ("*** 開始 ***")

const filename=process.argv[2]

console.error (filename)

const json_str = fs.readFileSync (filename,'utf8')
const array_aa = JSON.parse (json_str)

console.error("array_aa.length = " + array_aa.length)

var array_out = pick_up_proc(array_aa)


sort_proc(array_out)

out_proc(array_out)

console.error ("*** 終了 ***")
// ---------------------------------------------------------------
```

実行方法

```bash
./read_city.js city.list.json > city_list.txt
```

実行結果 (1402 の内の冒頭 50)

```text:city_list.txt
Abashiri	2130741	44.02	144.27
Abiko	2113164	35.87	140.02
Abira	2130732	42.82	141.83
Ageki	1865721	35.15	136.52
Agematsu	1865720	35.78	137.69
Ageo	1865714	35.97	139.59
Aibetsu	2130723	43.91	142.58
Aichi-ken	1865694	35.18	136.91
Aioi-shi	1865661	34.80	134.47
Aisai	6822212	35.16	136.73
Ajigasawa	2130708	40.77	140.20
Akabira	2130705	43.55	142.05
Akaigawa	2130700	43.08	140.82
Akanuma	2113136	37.37	140.43
Akashi	1847966	34.63	134.98
Akashichō	1865485	35.67	139.78
Aki	1865449	33.50	133.90
Akiruno-shi	6822131	35.73	139.29
Akita	2113126	39.72	140.12
Akita Shi	2113719	39.72	140.10
Akita-ken	2113124	39.75	140.41
Akkeshi	2130677	43.04	144.85
Ako	1865412	34.75	134.40
Akuchi	1865404	35.02	133.63
Akune	1865401	32.02	130.20
Amagasaki	1865387	34.72	135.42
Amagi	1865375	33.42	130.65
Ami	2113115	36.03	140.20
Anamizu	1865312	37.23	136.90
Anan	1865309	33.92	134.65
Anjo	1865294	34.96	137.08
Annaka	1865290	36.32	138.90
Aoichō	1865264	35.17	136.92
Aoki	1865256	36.37	138.13
Aomori-ken	2130656	40.78	140.83
Aomori-shi	2130658	40.82	140.74
Aone	2114152	38.14	140.53
Arai	1865207	37.02	138.25
Arimatsu	1865110	35.07	136.97
Arita	1865103	33.18	129.90
Asagaya	1865090	35.70	139.65
Asahi	1865086	35.90	136.66
Asahi	6416230	34.06	133.00
Asahi	6697514	35.97	136.12
Asahi	2113077	35.72	140.65
Asahikawa	2130629	43.77	142.37
Asaka	1907299	35.80	139.60
Ashibetsu	2130612	43.51	142.19
Ashiharachō	1865006	34.67	135.50
Ashikaga	1865005	36.33	139.45
```