概要
jsdoでヒートマップやってみた。
resasから、ajaxでデータ取って、geojsonのデータと合わせて、jsonを作るところ。
作ったjson
[{"cityName":"山形市","ratio":0.38},{"cityName":"米沢市","ratio":0.46},{"cityName":"鶴岡市","ratio":0.52},{"cityName":"酒田市","ratio":0.57},{"cityName":"新庄市","ratio":0.51},{"cityName":"寒河江市","ratio":0.48},{"cityName":"上山市","ratio":0.61},{"cityName":"村山市","ratio":0.54},{"cityName":"長井市","ratio":0.49},{"cityName":"天童市","ratio":0.51},{"cityName":"東根市","ratio":0.24},{"cityName":"尾花沢市","ratio":0.68},{"cityName":"南陽市","ratio":0.51},{"cityName":"東村山郡山辺町","ratio":0.35},{"cityName":"東村山郡中山町","ratio":0.54},{"cityName":"西村山郡河北町","ratio":0.5},{"cityName":"西村山郡西川町","ratio":0.61},{"cityName":"西村山郡朝日町","ratio":0.64},{"cityName":"西村山郡大江町","ratio":0.56},{"cityName":"北村山郡大石田町","ratio":0.67},{"cityName":"最上郡金山町","ratio":0.64},{"cityName":"最上郡最上町","ratio":0.69},{"cityName":"最上郡舟形町","ratio":0.61},{"cityName":"最上郡真室川町","ratio":0.59},{"cityName":"最上郡大蔵村","ratio":0.77},{"cityName":"最上郡鮭川村","ratio":0.78},{"cityName":"最上郡戸沢村","ratio":0.73},{"cityName":"東置賜郡高畠町","ratio":0.48},{"cityName":"東置賜郡川西町","ratio":0.64},{"cityName":"西置賜郡小国町","ratio":0.53},{"cityName":"西置賜郡白鷹町","ratio":0.57},{"cityName":"西置賜郡飯豊町","ratio":0.6},{"cityName":"東田川郡三川町","ratio":0.52},{"cityName":"東田川郡庄内町","ratio":0.57},{"cityName":"飽海郡遊佐町","ratio":0.68}]
成果物
説明
Jquery v1.8.3を使って、ajaxでresasのデータ読み取って、下記のgeojsonのデータと合わせて
arrayにpushして、JSON.stringifyしてBlobして URL.createObjectURLしてダウンロードする。
var geo = {
"06207": "上山市",
"06341": "北村山郡大石田町",
"06213": "南陽市",
"06210": "天童市",
"06206": "寒河江市",
"06212": "尾花沢市",
"06201": "山形市",
"06205": "新庄市",
"06365": "最上郡大蔵村",
"06367": "最上郡戸沢村",
"06362": "最上郡最上町",
"06364": "最上郡真室川町",
"06363": "最上郡舟形町",
"06361": "最上郡金山町",
"06366": "最上郡鮭川村",
"06208": "村山市",
"06302": "東村山郡中山町",
"06301": "東村山郡山辺町",
"06211": "東根市",
"06426": "東田川郡三川町",
"06428": "東田川郡庄内町",
"06382": "東置賜郡川西町",
"06381": "東置賜郡高畠町",
"06202": "米沢市",
"06324": "西村山郡大江町",
"06323": "西村山郡朝日町",
"06321": "西村山郡河北町",
"06322": "西村山郡西川町",
"06401": "西置賜郡小国町",
"06402": "西置賜郡白鷹町",
"06403": "西置賜郡飯豊町",
"06204": "酒田市",
"06209": "長井市",
"06461": "飽海郡遊佐町",
"06203": "鶴岡市"
};