Original Idea: http://rud.is/b/2015/05/14/geojson-hexagonal-statebins-in-r/ by boB Rudis (@hrbrmstr)
使用したデータ
Original Idea: http://rud.is/b/2015/05/14/geojson-hexagonal-statebins-in-r/ by boB Rudis (@hrbrmstr)
使用したデータ
{"type":"FeatureCollection","features":[{"type":"Feature","id":1,"properties":{"names_1_20":"shibetoro","code_1_20":6848},"geometry":{"type":"Polygon","coordinates":[[[148,46],[149,46],[149,45.33333],[148,45.33333],[148,46]]]}},{"type":"Feature","id":2,"properties":{"names_1_20":"bettobu","code_1_20":6748},"geometry":{"type":"Polygon","coordinates":[[[148,45.33333],[149,45.33333],[149,44.66666],[148,44.66666],[148,45.33333]]]}},{"type":"Feature","id":3,"properties":{"names_1_20":"shana","code_1_20":6747},"geometry":{"type":"Polygon","coordinates":[[[147,45.33333],[148,45.33333],[148,44.66666],[147,44.66666],[147,45.33333]]]}},{"type":"Feature","id":4,"properties":{"names_1_20":"urumombekko","code_1_20":6647},"geometry":{"type":"Polygon","coordinates":[[[147,44.66666],[148,44.66666],[148,44],[147,44],[147,44.66666]]]}},{"type":"Feature","id":5,"properties":{"names_1_20":"atoiyamisaki","code_1_20":6646},"geometry":{"type":"Polygon","coordinates":[[[146,44.66666],[147,44.66666],[147,44],[146,44],[146,44.66666]]]}},{"type":"Feature","id":6,"properties":{"names_1_20":"shikotanto","code_1_20":6546},"geometry":{"type":"Polygon","coordinates":[[[146,44],[147,44],[147,43.33333],[146,43.33333],[146,44]]]}},{"type":"Feature","id":7,"properties":{"names_1_20":"shiretokomisaki","code_1_20":6645},"geometry":{"type":"Polygon","coordinates":[[[145,44.66666],[146,44.66666],[146,44],[145,44],[145,44.66666]]]}},{"type":"Feature","id":8,"properties":{"names_1_20":"shibetsu","code_1_20":6545},"geometry":{"type":"Polygon","coordinates":[[[145,44],[146,44],[146,43.33333],[145,43.33333],[145,44]]]}},{"type":"Feature","id":9,"properties":{"names_1_20":"nemuro","code_1_20":6445},"geometry":{"type":"Polygon","coordinates":[[[145,43.33333],[146,43.33333],[146,42.66666],[145,42.66666],[145,43.33333]]]}},{"type":"Feature","id":10,"properties":{"names_1_20":"abashiri","code_1_20":6644},"geometry":{"type":"Polygon","coordinates":[[[144,44.66666],[145,44.66666],[145,44],[144,44],[144,44.66666]]]}},{"type":"Feature","id":11,"properties":{"names_1_20":"shari","code_1_20":6544},"geometry":{"type":"Polygon","coordinates":[[[144,44],[145,44],[145,43.33333],[144,43.33333],[144,44]]]}},{"type":"Feature","id":12,"properties":{"names_1_20":"kushiro","code_1_20":6444},"geometry":{"type":"Polygon","coordinates":[[[144,43.33333],[145,43.33333],[145,42.66666],[144,42.66666],[144,43.33333]]]}},{"type":"Feature","id":13,"properties":{"names_1_20":"mombetsu","code_1_20":6643},"geometry":{"type":"Polygon","coordinates":[[[143,44.66666],[144,44.66666],[144,44],[143,44],[143,44.66666]]]}},{"type":"Feature","id":14,"properties":{"names_1_20":"kitami","code_1_20":6543},"geometry":{"type":"Polygon","coordinates":[[[143,44],[144,44],[144,43.33333],[143,43.33333],[143,44]]]}},{"type":"Feature","id":15,"properties":{"names_1_20":"obihiro","code_1_20":6443},"geometry":{"type":"Polygon","coordinates":[[[143,43.33333],[144,43.33333],[144,42.66666],[143,42.66666],[143,43.33333]]]}},{"type":"Feature","id":16,"properties":{"names_1_20":"hiro","code_1_20":6343},"geometry":{"type":"Polygon","coordinates":[[[143,42.66666],[144,42.66666],[144,42],[143,42],[143,42.66666]]]}},{"type":"Feature","id":17,"properties":{"names_1_20":"esashi","code_1_20":6742},"geometry":{"type":"Polygon","coordinates":[[[142,45.33333],[143,45.33333],[143,44.66666],[142,44.66666],[142,45.33333]]]}},{"type":"Feature","id":18,"properties":{"names_1_20":"nayoro","code_1_20":6642},"geometry":{"type":"Polygon","coordinates":[[[142,44.66666],[143,44.66666],[143,44],[142,44],[142,44.66666]]]}},{"type":"Feature","id":19,"properties":{"names_1_20":"asahikawa","code_1_20":6542},"geometry":{"type":"Polygon","coordinates":[[[142,44],[143,44],[143,43.33333],[142,43.33333],[142,44]]]}},{"type":"Feature","id":20,"properties":{"names_1_20":"yobaridake","code_1_20":6442},"geometry":{"type":"Polygon","coordinates":[[[142,43.33333],[143,43.33333],[143,42.66666],[142,42.66666],[142,43.33333]]]}},{"type":"Feature","id":21,"properties":{"names_1_20":"urakawa","code_1_20":6342},"geometry":{"type":"Polygon","coordinates":[[[142,42.66666],[143,42.66666],[143,42],[142,42],[142,42.66666]]]}},{"type":"Feature","id":22,"properties":{"names_1_20":"wakkanai","code_1_20":6841},"geometry":{"type":"Polygon","coordinates":[[[141,46],[142,46],[142,45.33333],[141,45.33333],[141,46]]]}},{"type":"Feature","id":23,"properties":{"names_1_20":"teshio","code_1_20":6741},"geometry":{"type":"Polygon","coordinates":[[[141,45.33333],[142,45.33333],[142,44.66666],[141,44.66666],[141,45.33333]]]}},{"type":"Feature","id":24,"properties":{"names_1_20":"haboro","code_1_20":6641},"geometry":{"type":"Polygon","coordinates":[[[141,44.66666],[142,44.66666],[142,44],[141,44],[141,44.66666]]]}},{"type":"Feature","id":25,"properties":{"names_1_20":"rumoi","code_1_20":6541},"geometry":{"type":"Polygon","coordinates":[[[141,44],[142,44],[142,43.33333],[141,43.33333],[141,44]]]}},{"type":"Feature","id":26,"properties":{"names_1_20":"sapporo","code_1_20":6441},"geometry":{"type":"Polygon","coordinates":[[[141,43.33333],[142,43.33333],[142,42.66666],[141,42.66666],[141,43.33333]]]}},{"type":"Feature","id":27,"properties":{"names_1_20":"tomakomai","code_1_20":6341},"geometry":{"type":"Polygon","coordinates":[[[141,42.66666],[142,42.66666],[142,42],[141,42],[141,42.66666]]]}},{"type":"Feature","id":28,"properties":{"names_1_20":"shiriyazaki","code_1_20":6241},"geometry":{"type":"Polygon","coordinates":[[[141,42],[142,42],[142,41.33333],[141,41.33333],[141,42]]]}},{"type":"Feature","id":29,"properties":{"names_1_20":"iwanai","code_1_20":6440},"geometry":{"type":"Polygon","coordinates":[[[140,43.33333],[141,43.33333],[141,42.66666],[140,42.66666],[140,43.33333]]]}},{"type":"Feature","id":30,"properties":{"names_1_20":"muroran","code_1_20":6340},"geometry":{"type":"Polygon","coordinates":[[[140,42.66666],[141,42.66666],[141,42],[140,42],[140,42.66666]]]}},{"type":"Feature","id":31,"properties":{"names_1_20":"hakodate","code_1_20":6240},"geometry":{"type":"Polygon","coordinates":[[[140,42],[141,42],[141,41.33333],[140,41.33333],[140,42]]]}},{"type":"Feature","id":32,"properties":{"names_1_20":"kudo","code_1_20":6339},"geometry":{"type":"Polygon","coordinates":[[[139,42.66666],[140,42.66666],[140,42],[139,42],[139,42.66666]]]}},{"type":"Feature","id":33,"properties":{"names_1_20":"oshimaoshima","code_1_20":6239},"geometry":{"type":"Polygon","coordinates":[[[139,42],[140,42],[140,41.33333],[139,41.33333],[139,42]]]}},{"type":"Feature","id":34,"properties":{"names_1_20":"noheji","code_1_20":6141},"geometry":{"type":"Polygon","coordinates":[[[141,41.33333],[142,41.33333],[142,40.66666],[141,40.66666],[141,41.33333]]]}},{"type":"Feature","id":35,"properties":{"names_1_20":"hachinohe","code_1_20":6041},"geometry":{"type":"Polygon","coordinates":[[[141,40.66666],[142,40.66666],[142,40],[141,40],[141,40.66666]]]}},{"type":"Feature","id":36,"properties":{"names_1_20":"morioka","code_1_20":5941},"geometry":{"type":"Polygon","coordinates":[[[141,40],[142,40],[142,39.33333],[141,39.33333],[141,40]]]}},{"type":"Feature","id":37,"properties":{"names_1_20":"ichinoseki","code_1_20":5841},"geometry":{"type":"Polygon","coordinates":[[[141,39.33333],[142,39.33333],[142,38.66666],[141,38.66666],[141,39.33333]]]}},{"type":"Feature","id":38,"properties":{"names_1_20":"ishinomaki","code_1_20":5741},"geometry":{"type":"Polygon","coordinates":[[[141,38.66666],[142,38.66666],[142,38],[141,38],[141,38.66666]]]}},{"type":"Feature","id":39,"properties":{"names_1_20":"aomori","code_1_20":6140},"geometry":{"type":"Polygon","coordinates":[[[140,41.33333],[141,41.33333],[141,40.66666],[140,40.66666],[140,41.33333]]]}},{"type":"Feature","id":40,"properties":{"names_1_20":"hirosaki","code_1_20":6040},"geometry":{"type":"Polygon","coordinates":[[[140,40.66666],[141,40.66666],[141,40],[140,40],[140,40.66666]]]}},{"type":"Feature","id":41,"properties":{"names_1_20":"akita","code_1_20":5940},"geometry":{"type":"Polygon","coordinates":[[[140,40],[141,40],[141,39.33333],[140,39.33333],[140,40]]]}},{"type":"Feature","id":42,"properties":{"names_1_20":"shinjo","code_1_20":5840},"geometry":{"type":"Polygon","coordinates":[[[140,39.33333],[141,39.33333],[141,38.66666],[140,38.66666],[140,39.33333]]]}},{"type":"Feature","id":43,"properties":{"names_1_20":"sendai","code_1_20":5740},"geometry":{"type":"Polygon","coordinates":[[[140,38.66666],[141,38.66666],[141,38],[140,38],[140,38.66666]]]}},{"type":"Feature","id":44,"properties":{"names_1_20":"fukushima","code_1_20":5640},"geometry":{"type":"Polygon","coordinates":[[[140,38],[141,38],[141,37.33333],[140,37.33333],[140,38]]]}},{"type":"Feature","id":45,"properties":{"names_1_20":"shirakawa","code_1_20":5540},"geometry":{"type":"Polygon","coordinates":[[[140,37.33333],[141,37.33333],[141,36.66666],[140,36.66666],[140,37.33333]]]}},{"type":"Feature","id":46,"properties":{"names_1_20":"mito","code_1_20":5440},"geometry":{"type":"Polygon","coordinates":[[[140,36.66666],[141,36.66666],[141,36],[140,36],[140,36.66666]]]}},{"type":"Feature","id":47,"properties":{"names_1_20":"chiba","code_1_20":5340},"geometry":{"type":"Polygon","coordinates":[[[140,36],[141,36],[141,35.33333],[140,35.33333],[140,36]]]}},{"type":"Feature","id":48,"properties":{"names_1_20":"otaki","code_1_20":5240},"geometry":{"type":"Polygon","coordinates":[[[140,35.33333],[141,35.33333],[141,34.66666],[140,34.66666],[140,35.33333]]]}},{"type":"Feature","id":49,"properties":{"names_1_20":"fukaura","code_1_20":6039},"geometry":{"type":"Polygon","coordinates":[[[139,40.66666],[140,40.66666],[140,40],[139,40],[139,40.66666]]]}},{"type":"Feature","id":50,"properties":{"names_1_20":"oga","code_1_20":5939},"geometry":{"type":"Polygon","coordinates":[[[139,40],[140,40],[140,39.33333],[139,39.33333],[139,40]]]}},{"type":"Feature","id":51,"properties":{"names_1_20":"sakata","code_1_20":5839},"geometry":{"type":"Polygon","coordinates":[[[139,39.33333],[140,39.33333],[140,38.66666],[139,38.66666],[139,39.33333]]]}},{"type":"Feature","id":52,"properties":{"names_1_20":"murakami","code_1_20":5739},"geometry":{"type":"Polygon","coordinates":[[[139,38.66666],[140,38.66666],[140,38],[139,38],[139,38.66666]]]}},{"type":"Feature","id":53,"properties":{"names_1_20":"niigata","code_1_20":5639},"geometry":{"type":"Polygon","coordinates":[[[139,38],[140,38],[140,37.33333],[139,37.33333],[139,38]]]}},{"type":"Feature","id":54,"properties":{"names_1_20":"nikko","code_1_20":5539},"geometry":{"type":"Polygon","coordinates":[[[139,37.33333],[140,37.33333],[140,36.66666],[139,36.66666],[139,37.33333]]]}},{"type":"Feature","id":55,"properties":{"names_1_20":"utsunomiya","code_1_20":5439},"geometry":{"type":"Polygon","coordinates":[[[139,36.66666],[140,36.66666],[140,36],[139,36],[139,36.66666]]]}},{"type":"Feature","id":56,"properties":{"names_1_20":"tokyo","code_1_20":5339},"geometry":{"type":"Polygon","coordinates":[[[139,36],[140,36],[140,35.33333],[139,35.33333],[139,36]]]}},{"type":"Feature","id":57,"properties":{"names_1_20":"yokosuka","code_1_20":5239},"geometry":{"type":"Polygon","coordinates":[[[139,35.33333],[140,35.33333],[140,34.66666],[139,34.66666],[139,35.33333]]]}},{"type":"Feature","id":58,"properties":{"names_1_20":"miyakejima","code_1_20":5139},"geometry":{"type":"Polygon","coordinates":[[[139,34.66666],[140,34.66666],[140,34],[139,34],[139,34.66666]]]}},{"type":"Feature","id":59,"properties":{"names_1_20":"mikurajima","code_1_20":5039},"geometry":{"type":"Polygon","coordinates":[[[139,34],[140,34],[140,33.33333],[139,33.33333],[139,34]]]}},{"type":"Feature","id":60,"properties":{"names_1_20":"aikawa","code_1_20":5738},"geometry":{"type":"Polygon","coordinates":[[[138,38.66666],[139,38.66666],[139,38],[138,38],[138,38.66666]]]}},{"type":"Feature","id":61,"properties":{"names_1_20":"nagaoka","code_1_20":5638},"geometry":{"type":"Polygon","coordinates":[[[138,38],[139,38],[139,37.33333],[138,37.33333],[138,38]]]}},{"type":"Feature","id":62,"properties":{"names_1_20":"takada","code_1_20":5538},"geometry":{"type":"Polygon","coordinates":[[[138,37.33333],[139,37.33333],[139,36.66666],[138,36.66666],[138,37.33333]]]}},{"type":"Feature","id":63,"properties":{"names_1_20":"nagano","code_1_20":5438},"geometry":{"type":"Polygon","coordinates":[[[138,36.66666],[139,36.66666],[139,36],[138,36],[138,36.66666]]]}},{"type":"Feature","id":64,"properties":{"names_1_20":"kofu","code_1_20":5338},"geometry":{"type":"Polygon","coordinates":[[[138,36],[139,36],[139,35.33333],[138,35.33333],[138,36]]]}},{"type":"Feature","id":65,"properties":{"names_1_20":"shizoka","code_1_20":5238},"geometry":{"type":"Polygon","coordinates":[[[138,35.33333],[139,35.33333],[139,34.66666],[138,34.66666],[138,35.33333]]]}},{"type":"Feature","id":66,"properties":{"names_1_20":"omaezaki","code_1_20":5138},"geometry":{"type":"Polygon","coordinates":[[[138,34.66666],[139,34.66666],[139,34],[138,34],[138,34.66666]]]}},{"type":"Feature","id":67,"properties":{"names_1_20":"wajima","code_1_20":5636},"geometry":{"type":"Polygon","coordinates":[[[136.5,38],[137.5,38],[137.5,37.33333],[136.5,37.33333],[136.5,38]]]}},{"type":"Feature","id":68,"properties":{"names_1_20":"toyama","code_1_20":5537},"geometry":{"type":"Polygon","coordinates":[[[137,37.33333],[138,37.33333],[138,36.66666],[137,36.66666],[137,37.33333]]]}},{"type":"Feature","id":69,"properties":{"names_1_20":"takayama","code_1_20":5437},"geometry":{"type":"Polygon","coordinates":[[[137,36.66666],[138,36.66666],[138,36],[137,36],[137,36.66666]]]}},{"type":"Feature","id":70,"properties":{"names_1_20":"iida","code_1_20":5337},"geometry":{"type":"Polygon","coordinates":[[[137,36],[138,36],[138,35.33333],[137,35.33333],[137,36]]]}},{"type":"Feature","id":71,"properties":{"names_1_20":"toyohashi","code_1_20":5237},"geometry":{"type":"Polygon","coordinates":[[[137,35.33333],[138,35.33333],[138,34.66666],[137,34.66666],[137,35.33333]]]}},{"type":"Feature","id":72,"properties":{"names_1_20":"iragomisaki","code_1_20":5137},"geometry":{"type":"Polygon","coordinates":[[[137,34.66666],[138,34.66666],[138,34],[137,34],[137,34.66666]]]}},{"type":"Feature","id":73,"properties":{"names_1_20":"nanao","code_1_20":5536},"geometry":{"type":"Polygon","coordinates":[[[136,37.33333],[137,37.33333],[137,36.66666],[136,36.66666],[136,37.33333]]]}},{"type":"Feature","id":74,"properties":{"names_1_20":"kanazawa","code_1_20":5436},"geometry":{"type":"Polygon","coordinates":[[[136,36.66666],[137,36.66666],[137,36],[136,36],[136,36.66666]]]}},{"type":"Feature","id":75,"properties":{"names_1_20":"gifu","code_1_20":5336},"geometry":{"type":"Polygon","coordinates":[[[136,36],[137,36],[137,35.33333],[136,35.33333],[136,36]]]}},{"type":"Feature","id":76,"properties":{"names_1_20":"nagoya","code_1_20":5236},"geometry":{"type":"Polygon","coordinates":[[[136,35.33333],[137,35.33333],[137,34.66666],[136,34.66666],[136,35.33333]]]}},{"type":"Feature","id":77,"properties":{"names_1_20":"ise","code_1_20":5136},"geometry":{"type":"Polygon","coordinates":[[[136,34.66666],[137,34.66666],[137,34],[136,34],[136,34.66666]]]}},{"type":"Feature","id":78,"properties":{"names_1_20":"kinomoto","code_1_20":5036},"geometry":{"type":"Polygon","coordinates":[[[136,34],[137,34],[137,33.33333],[136,33.33333],[136,34]]]}},{"type":"Feature","id":79,"properties":{"names_1_20":"miyazu","code_1_20":5335},"geometry":{"type":"Polygon","coordinates":[[[135,36],[136,36],[136,35.33333],[135,35.33333],[135,36]]]}},{"type":"Feature","id":80,"properties":{"names_1_20":"kyotoyobiosaka","code_1_20":5235},"geometry":{"type":"Polygon","coordinates":[[[135,35.33333],[136,35.33333],[136,34.66666],[135,34.66666],[135,35.33333]]]}},{"type":"Feature","id":81,"properties":{"names_1_20":"wakayama","code_1_20":5135},"geometry":{"type":"Polygon","coordinates":[[[135,34.66666],[136,34.66666],[136,34],[135,34],[135,34.66666]]]}},{"type":"Feature","id":82,"properties":{"names_1_20":"tanabe","code_1_20":5035},"geometry":{"type":"Polygon","coordinates":[[[135,34],[136,34],[136,33.33333],[135,33.33333],[135,34]]]}},{"type":"Feature","id":83,"properties":{"names_1_20":"tottori","code_1_20":5334},"geometry":{"type":"Polygon","coordinates":[[[134,36],[135,36],[135,35.33333],[134,35.33333],[134,36]]]}},{"type":"Feature","id":84,"properties":{"names_1_20":"himeji","code_1_20":5234},"geometry":{"type":"Polygon","coordinates":[[[134,35.33333],[135,35.33333],[135,34.66666],[134,34.66666],[134,35.33333]]]}},{"type":"Feature","id":85,"properties":{"names_1_20":"tokushima","code_1_20":5134},"geometry":{"type":"Polygon","coordinates":[[[134,34.66666],[135,34.66666],[135,34],[134,34],[134,34.66666]]]}},{"type":"Feature","id":86,"properties":{"names_1_20":"tsurugisan","code_1_20":5034},"geometry":{"type":"Polygon","coordinates":[[[134,34],[135,34],[135,33.33333],[134,33.33333],[134,34]]]}},{"type":"Feature","id":87,"properties":{"names_1_20":"saigo","code_1_20":5433},"geometry":{"type":"Polygon","coordinates":[[[133,36.66666],[134,36.66666],[134,36],[133,36],[133,36.66666]]]}},{"type":"Feature","id":88,"properties":{"names_1_20":"matsue","code_1_20":5333},"geometry":{"type":"Polygon","coordinates":[[[133,36],[134,36],[134,35.33333],[133,35.33333],[133,36]]]}},{"type":"Feature","id":89,"properties":{"names_1_20":"takahashi","code_1_20":5233},"geometry":{"type":"Polygon","coordinates":[[[133,35.33333],[134,35.33333],[134,34.66666],[133,34.66666],[133,35.33333]]]}},{"type":"Feature","id":90,"properties":{"names_1_20":"okayamaoyobimarugame","code_1_20":5133},"geometry":{"type":"Polygon","coordinates":[[[133,34.66666],[134,34.66666],[134,34],[133,34],[133,34.66666]]]}},{"type":"Feature","id":91,"properties":{"names_1_20":"kochi","code_1_20":5033},"geometry":{"type":"Polygon","coordinates":[[[133,34],[134,34],[134,33.33333],[133,33.33333],[133,34]]]}},{"type":"Feature","id":92,"properties":{"names_1_20":"kubokawa","code_1_20":4933},"geometry":{"type":"Polygon","coordinates":[[[133,33.33333],[134,33.33333],[134,32.66666],[133,32.66666],[133,33.33333]]]}},{"type":"Feature","id":93,"properties":{"names_1_20":"taisha","code_1_20":5332},"geometry":{"type":"Polygon","coordinates":[[[132,36],[133,36],[133,35.33333],[132,35.33333],[132,36]]]}},{"type":"Feature","id":94,"properties":{"names_1_20":"hamada","code_1_20":5232},"geometry":{"type":"Polygon","coordinates":[[[132,35.33333],[133,35.33333],[133,34.66666],[132,34.66666],[132,35.33333]]]}},{"type":"Feature","id":95,"properties":{"names_1_20":"hiroshima","code_1_20":5132},"geometry":{"type":"Polygon","coordinates":[[[132,34.66666],[133,34.66666],[133,34],[132,34],[132,34.66666]]]}},{"type":"Feature","id":96,"properties":{"names_1_20":"matsuyama","code_1_20":5032},"geometry":{"type":"Polygon","coordinates":[[[132,34],[133,34],[133,33.33333],[132,33.33333],[132,34]]]}},{"type":"Feature","id":97,"properties":{"names_1_20":"uwajima","code_1_20":4932},"geometry":{"type":"Polygon","coordinates":[[[132,33.33333],[133,33.33333],[133,32.66666],[132,32.66666],[132,33.33333]]]}},{"type":"Feature","id":98,"properties":{"names_1_20":"mishima","code_1_20":5231},"geometry":{"type":"Polygon","coordinates":[[[131,35.33333],[132,35.33333],[132,34.66666],[131,34.66666],[131,35.33333]]]}},{"type":"Feature","id":99,"properties":{"names_1_20":"yamaguchi","code_1_20":5131},"geometry":{"type":"Polygon","coordinates":[[[131,34.66666],[132,34.66666],[132,34],[131,34],[131,34.66666]]]}},{"type":"Feature","id":100,"properties":{"names_1_20":"nakatsu","code_1_20":5031},"geometry":{"type":"Polygon","coordinates":[[[131,34],[132,34],[132,33.33333],[131,33.33333],[131,34]]]}},{"type":"Feature","id":101,"properties":{"names_1_20":"oita","code_1_20":4931},"geometry":{"type":"Polygon","coordinates":[[[131,33.33333],[132,33.33333],[132,32.66666],[131,32.66666],[131,33.33333]]]}},{"type":"Feature","id":102,"properties":{"names_1_20":"nobeoka","code_1_20":4831},"geometry":{"type":"Polygon","coordinates":[[[131,32.66666],[132,32.66666],[132,32],[131,32],[131,32.66666]]]}},{"type":"Feature","id":103,"properties":{"names_1_20":"miyazaki","code_1_20":4731},"geometry":{"type":"Polygon","coordinates":[[[131,32],[132,32],[132,31.33333],[131,31.33333],[131,32]]]}},{"type":"Feature","id":104,"properties":{"names_1_20":"kogushi","code_1_20":5130},"geometry":{"type":"Polygon","coordinates":[[[130,34.66666],[131,34.66666],[131,34],[130,34],[130,34.66666]]]}},{"type":"Feature","id":105,"properties":{"names_1_20":"fukoka","code_1_20":5030},"geometry":{"type":"Polygon","coordinates":[[[130,34],[131,34],[131,33.33333],[130,33.33333],[130,34]]]}},{"type":"Feature","id":106,"properties":{"names_1_20":"kumamoto","code_1_20":4930},"geometry":{"type":"Polygon","coordinates":[[[130,33.33333],[131,33.33333],[131,32.66666],[130,32.66666],[130,33.33333]]]}},{"type":"Feature","id":107,"properties":{"names_1_20":"yatsushiro","code_1_20":4830},"geometry":{"type":"Polygon","coordinates":[[[130,32.66666],[131,32.66666],[131,32],[130,32],[130,32.66666]]]}},{"type":"Feature","id":108,"properties":{"names_1_20":"kagoshima","code_1_20":4730},"geometry":{"type":"Polygon","coordinates":[[[130,32],[131,32],[131,31.33333],[130,31.33333],[130,32]]]}},{"type":"Feature","id":109,"properties":{"names_1_20":"kaimondake","code_1_20":4630},"geometry":{"type":"Polygon","coordinates":[[[130,31.33333],[131,31.33333],[131,30.66666],[130,30.66666],[130,31.33333]]]}},{"type":"Feature","id":110,"properties":{"names_1_20":"izuhara","code_1_20":5129},"geometry":{"type":"Polygon","coordinates":[[[129,34.66666],[130,34.66666],[130,34],[129,34],[129,34.66666]]]}},{"type":"Feature","id":111,"properties":{"names_1_20":"karatsu","code_1_20":5029},"geometry":{"type":"Polygon","coordinates":[[[129,34],[130,34],[130,33.33333],[129,33.33333],[129,34]]]}},{"type":"Feature","id":112,"properties":{"names_1_20":"nagasaki","code_1_20":4929},"geometry":{"type":"Polygon","coordinates":[[[129,33.33333],[130,33.33333],[130,32.66666],[129,32.66666],[129,33.33333]]]}},{"type":"Feature","id":113,"properties":{"names_1_20":"nomozaki","code_1_20":4829},"geometry":{"type":"Polygon","coordinates":[[[129,32.66666],[130,32.66666],[130,32],[129,32],[129,32.66666]]]}},{"type":"Feature","id":114,"properties":{"names_1_20":"koshikijima","code_1_20":4729},"geometry":{"type":"Polygon","coordinates":[[[129,32],[130,32],[130,31.33333],[129,31.33333],[129,32]]]}},{"type":"Feature","id":115,"properties":{"names_1_20":"kuroshima","code_1_20":4629},"geometry":{"type":"Polygon","coordinates":[[[129,31.33333],[130,31.33333],[130,30.66666],[129,30.66666],[129,31.33333]]]}},{"type":"Feature","id":116,"properties":{"names_1_20":"fukue","code_1_20":4928},"geometry":{"type":"Polygon","coordinates":[[[128,33.33333],[129,33.33333],[129,32.66666],[128,32.66666],[128,33.33333]]]}},{"type":"Feature","id":117,"properties":{"names_1_20":"tomie","code_1_20":4828},"geometry":{"type":"Polygon","coordinates":[[[128,32.66666],[129,32.66666],[129,32],[128,32],[128,32.66666]]]}},{"type":"Feature","id":118,"properties":{"names_1_20":"hachijojima","code_1_20":4939},"geometry":{"type":"Polygon","coordinates":[[[139,33.33333],[140,33.33333],[140,32.66666],[139,32.66666],[139,33.33333]]]}},{"type":"Feature","id":119,"properties":{"names_1_20":"yakushima","code_1_20":4530},"geometry":{"type":"Polygon","coordinates":[[[130,30.66666],[131,30.66666],[131,30],[130,30],[130,30.66666]]]}},{"type":"Feature","id":120,"properties":{"names_1_20":"nakanoshima","code_1_20":4429},"geometry":{"type":"Polygon","coordinates":[[[129,30],[130,30],[130,29.33333],[129,29.33333],[129,30]]]}},{"type":"Feature","id":121,"properties":{"names_1_20":"takarajima","code_1_20":4329},"geometry":{"type":"Polygon","coordinates":[[[129,29.33333],[130,29.33333],[130,28.66666],[129,28.66666],[129,29.33333]]]}},{"type":"Feature","id":122,"properties":{"names_1_20":"amamioshima","code_1_20":4229},"geometry":{"type":"Polygon","coordinates":[[[129,28.66666],[130,28.66666],[130,28],[129,28],[129,28.66666]]]}},{"type":"Feature","id":123,"properties":{"names_1_20":"tokunoshima","code_1_20":4128},"geometry":{"type":"Polygon","coordinates":[[[128,28],[129,28],[129,27.33333],[128,27.33333],[128,28]]]}},{"type":"Feature","id":124,"properties":{"names_1_20":"yoronjima","code_1_20":4027},"geometry":{"type":"Polygon","coordinates":[[[127.5,27.33333],[128.5,27.33333],[128.5,26.66666],[127.5,26.66666],[127.5,27.33333]]]}},{"type":"Feature","id":125,"properties":{"names_1_20":"naha","code_1_20":3927},"geometry":{"type":"Polygon","coordinates":[[[127.5,26.66666],[128.5,26.66666],[128.5,26],[127.5,26],[127.5,26.66666]]]}},{"type":"Feature","id":126,"properties":{"names_1_20":"kumejima","code_1_20":3926},"geometry":{"type":"Polygon","coordinates":[[[126.5,26.66666],[127.5,26.66666],[127.5,26],[126.5,26],[126.5,26.66666]]]}},{"type":"Feature","id":127,"properties":{"names_1_20":"miyakojima","code_1_20":3724},"geometry":{"type":"Polygon","coordinates":[[[124.5,25],[125.5,25],[125.5,24.33333],[124.5,24.33333],[124.5,25]]]}},{"type":"Feature","id":128,"properties":{"names_1_20":"otsurijima","code_1_20":3823},"geometry":{"type":"Polygon","coordinates":[[[123,26],[124,26],[124,25.33333],[123,25.33333],[123,26]]]}},{"type":"Feature","id":129,"properties":{"names_1_20":"ishigakijima","code_1_20":3623},"geometry":{"type":"Polygon","coordinates":[[[123.5,24.66666],[124.5,24.66666],[124.5,24],[123.5,24],[123.5,24.66666]]]}},{"type":"Feature","id":130,"properties":{"names_1_20":"ogasawarashoto","code_1_20":4042},"geometry":{"type":"Polygon","coordinates":[[[142,27.33333],[143,27.33333],[143,26.66666],[142,26.66666],[142,27.33333]]]}}]} |
# create map data --------------------------------------------------------- | |
library(rvest) | |
library(dplyr) | |
library(tidyr) | |
library(Nippon) | |
library(rgdal) | |
url <- "http://www.gsi.go.jp/MAP/HISTORY/5-25-index5-25.html" %>% read_html() | |
names_1_20 <- vector() | |
code_1_20 <- vector() | |
html_nodes(url, css = "map area") %>% { | |
names_1_20 <<- html_attr(., "alt") %>% kana2roma(.) | |
code_1_20 <<- html_attr(., "href") %>% | |
sub(pattern = "/MAP/HISTORY/5-25-", replacement = "", x = .) %>% | |
sub(".html$", "", .) | |
} | |
res <- data.frame(names_1_20, code_1_20) %>% | |
dplyr::mutate(code_1_20 = as.numeric(as.character(code_1_20))) | |
## ---- -------------------------------------------------------------------- | |
library(geojsonio) | |
library(sp) | |
poly13 <- Polygons( | |
list(Polygon(cbind( | |
c(148.0, 148.0, 149.0, 149.0, 148.0), | |
c(46.0, 45.33333, 45.33333, 46.0, 46.0)))), "1") | |
poly14 <- Polygons( | |
list(Polygon(cbind( | |
c(148.0, 148.0, 149.0, 149.0, 148.0), | |
c(45.33333, 44.66666, 44.66666, 45.33333, 45.33333)))), "2") | |
poly15 <- Polygons( | |
list(Polygon(cbind( | |
c(147.0, 147.0, 148.0, 148.0, 147.0), | |
c(45.33333, 44.66666, 44.66666, 45.33333, 45.33333)))), "3") | |
poly16 <- Polygons( | |
list(Polygon(cbind( | |
c(147.0, 147.0, 148.0, 148.0, 147.0), | |
c(44.66666, 44.0, 44.0, 44.66666, 44.66666)))), "4") | |
poly25 <- Polygons( | |
list(Polygon(cbind( | |
c(146.0, 146.0, 147.0, 147.0, 146.0), | |
c(44.66666, 44.0, 44.0, 44.66666, 44.66666)))), "5") | |
poly26 <- Polygons( | |
list(Polygon(cbind( | |
c(146.0, 146.0, 147.0, 147.0, 146.0), | |
c(44.0, 43.33333, 43.33333, 44.0, 44.0)))), "6") | |
poly27 <- Polygons( | |
list(Polygon(cbind( | |
c(145.0, 145.0, 146.0, 146.0, 145.0), | |
c(44.66666, 44.0, 44.0, 44.66666, 44.66666)))), "7") | |
poly28 <- Polygons( | |
list(Polygon(cbind( | |
c(145.0, 145.0, 146.0, 146.0, 145.0), | |
c(44.0, 43.33333, 43.33333, 44.0, 44.0)))), "8") | |
poly29 <- Polygons( | |
list(Polygon(cbind( | |
c(145.0, 145.0, 146.0, 146.0, 145.0), | |
c(43.33333, 42.66666, 42.66666, 43.33333, 43.33333)))), "9") | |
poly30 <- Polygons( | |
list(Polygon(cbind( | |
c(144.0, 144.0, 145.0, 145.0, 144.0), | |
c(44.66666, 44.0, 44.0, 44.66666, 44.66666)))), "10") | |
poly31 <- Polygons( | |
list(Polygon(cbind( | |
c(144.0, 144.0, 145.0, 145.0, 144.0), | |
c(44.0, 43.33333, 43.33333, 44.0, 44.0)))), "11") | |
poly32 <- Polygons( | |
list(Polygon(cbind( | |
c(144.0, 144.0, 145.0, 145.0, 144.0), | |
c(43.33333, 42.66666, 42.66666, 43.33333, 43.33333)))), "12") | |
poly33 <- Polygons( | |
list(Polygon(cbind( | |
c(143.0, 143.0, 144.0, 144.0, 143.0), | |
c(44.66666, 44.0, 44.0, 44.66666, 44.66666)))), "13") | |
poly34 <- Polygons( | |
list(Polygon(cbind( | |
c(143.0, 143.0, 144.0, 144.0, 143.0), | |
c(44.0, 43.33333, 43.33333, 44.0, 44.0)))), "14") | |
poly35 <- Polygons( | |
list(Polygon(cbind( | |
c(143.0, 143.0, 144.0, 144.0, 143.0), | |
c(43.33333, 42.66666, 42.66666, 43.33333, 43.33333)))), "15") | |
poly36 <- Polygons( | |
list(Polygon(cbind( | |
c(143.0, 143.0, 144.0, 144.0, 143.0), | |
c(42.66666, 42.0, 42.0, 42.66666, 42.66666)))), "16") | |
poly37 <- Polygons( | |
list(Polygon(cbind( | |
c(142.0, 142.0, 143.0, 143.0, 142.0), | |
c(45.33333, 44.66666, 44.66666, 45.33333, 45.33333)))), "17") | |
poly38 <- Polygons( | |
list(Polygon(cbind( | |
c(142.0, 142.0, 143.0, 143.0, 142.0), | |
c(44.66666, 44.0, 44.0, 44.66666, 44.66666)))), "18") | |
poly39 <- Polygons( | |
list(Polygon(cbind( | |
c(142.0, 142.0, 143.0, 143.0, 142.0), | |
c(44.0, 43.33333, 43.33333, 44.0, 44.0)))), "19") | |
poly40 <- Polygons( | |
list(Polygon(cbind( | |
c(142.0, 142.0, 143.0, 143.0, 142.0), | |
c(43.33333, 42.66666, 42.66666, 43.33333, 43.33333)))), "20") | |
poly41 <- Polygons( | |
list(Polygon(cbind( | |
c(142.0, 142.0, 143.0, 143.0, 142.0), | |
c(42.66666, 42.0, 42.0, 42.66666, 42.66666)))), "21") | |
poly42 <- Polygons( | |
list(Polygon(cbind( | |
c(141.0, 141.0, 142.0, 142.0, 141.0), | |
c(46.0, 45.33333, 45.33333, 46.0, 46.0)))), "22") | |
poly43 <- Polygons( | |
list(Polygon(cbind( | |
c(141.0, 141.0, 142.0, 142.0, 141.0), | |
c(45.33333, 44.66666, 44.66666, 45.33333, 45.33333)))), "23") | |
poly44 <- Polygons( | |
list(Polygon(cbind( | |
c(141.0, 141.0, 142.0, 142.0, 141.0), | |
c(44.66666, 44.0, 44.0, 44.66666, 44.66666)))), "24") | |
poly45 <- Polygons( | |
list(Polygon(cbind( | |
c(141.0, 141.0, 142.0, 142.0, 141.0), | |
c(44.0, 43.33333, 43.33333, 44.0, 44.0)))), "25") | |
poly46 <- Polygons( | |
list(Polygon(cbind( | |
c(141.0, 141.0, 142.0, 142.0, 141.0), | |
c(43.33333, 42.66666, 42.66666, 43.33333, 43.33333)))), "26") | |
poly47 <- Polygons( | |
list(Polygon(cbind( | |
c(141.0, 141.0, 142.0, 142.0, 141.0), | |
c(42.66666, 42.0, 42.0, 42.66666, 42.66666)))), "27") | |
poly48 <- Polygons( | |
list(Polygon(cbind( | |
c(141.0, 141.0, 142.0, 142.0, 141.0), | |
c(42.0, 41.33333, 41.33333, 42.0, 42.0)))), "28") | |
poly49 <- Polygons( | |
list(Polygon(cbind( | |
c(140.0, 140.0, 141.0, 141.0, 140.0), | |
c(43.33333, 42.66666, 42.66666, 43.33333, 43.33333)))), "29") | |
poly50 <- Polygons( | |
list(Polygon(cbind( | |
c(140.0, 140.0, 141.0, 141.0, 140.0), | |
c(42.66666, 42.0, 42.0, 42.66666, 42.66666)))), "30") | |
poly51 <- Polygons( | |
list(Polygon(cbind( | |
c(140.0, 140.0, 141.0, 141.0, 140.0), | |
c(42.0, 41.33333, 41.33333, 42.0, 42.0)))), "31") | |
poly52 <- Polygons( | |
list(Polygon(cbind( | |
c(139.0, 139.0, 140.0, 140.0, 139.0), | |
c(42.66666, 42.0, 42.0, 42.66666, 42.66666)))), "32") | |
poly53 <- Polygons( | |
list(Polygon(cbind( | |
c(139.0, 139.0, 140.0, 140.0, 139.0), | |
c(42.0, 41.33333, 41.33333, 42.0, 42.0)))), "33") | |
poly54 <- Polygons( | |
list(Polygon(cbind( | |
c(141.0, 141.0, 142.0, 142.0, 141.0), | |
c(41.33333, 40.66666, 40.66666, 41.33333, 41.33333)))), "34") | |
poly55 <- Polygons( | |
list(Polygon(cbind( | |
c(141.0, 141.0, 142.0, 142.0, 141.0), | |
c(40.66666, 40.0, 40.0, 40.66666, 40.66666)))), "35") | |
poly56 <- Polygons( | |
list(Polygon(cbind( | |
c(141.0, 141.0, 142.0, 142.0, 141.0), | |
c(40.0, 39.33333, 39.33333, 40.0, 40.0)))), "36") | |
poly57 <- Polygons( | |
list(Polygon(cbind( | |
c(141.0, 141.0, 142.0, 142.0, 141.0), | |
c(39.33333, 38.66666, 38.66666, 39.33333, 39.33333)))), "37") | |
poly58 <- Polygons( | |
list(Polygon(cbind( | |
c(141.0, 141.0, 142.0, 142.0, 141.0), | |
c(38.66666, 38.0, 38.0, 38.66666, 38.66666)))), "38") | |
poly59 <- Polygons( | |
list(Polygon(cbind( | |
c(140.0, 140.0, 141.0, 141.0, 140.0), | |
c(41.33333, 40.66666, 40.66666, 41.33333, 41.33333)))), "39") | |
poly60 <- Polygons( | |
list(Polygon(cbind( | |
c(140.0, 140.0, 141.0, 141.0, 140.0), | |
c(40.66666, 40.0, 40.0, 40.66666, 40.66666)))), "40") | |
poly61 <- Polygons( | |
list(Polygon(cbind( | |
c(140.0, 140.0, 141.0, 141.0, 140.0), | |
c(40.0, 39.33333, 39.33333, 40.0, 40.0)))), "41") | |
poly62 <- Polygons( | |
list(Polygon(cbind( | |
c(140.0, 140.0, 141.0, 141.0, 140.0), | |
c(39.33333, 38.66666, 38.66666, 39.33333, 39.33333)))), "42") | |
poly63 <- Polygons( | |
list(Polygon(cbind( | |
c(140.0, 140.0, 141.0, 141.0, 140.0), | |
c(38.66666, 38.0, 38.0, 38.66666, 38.66666)))), "43") | |
poly64 <- Polygons( | |
list(Polygon(cbind( | |
c(140.0, 140.0, 141.0, 141.0, 140.0), | |
c(38.0, 37.33333, 37.33333, 38.0, 38.0)))), "44") | |
poly65 <- Polygons( | |
list(Polygon(cbind( | |
c(140.0, 140.0, 141.0, 141.0, 140.0), | |
c(37.33333, 36.66666, 36.66666, 37.33333, 37.33333)))), "45") | |
poly66 <- Polygons( | |
list(Polygon(cbind( | |
c(140.0, 140.0, 141.0, 141.0, 140.0), | |
c(36.66666, 36.0, 36.0, 36.66666, 36.66666)))), "46") | |
poly67 <- Polygons( | |
list(Polygon(cbind( | |
c(140.0, 140.0, 141.0, 141.0, 140.0), | |
c(36.0, 35.33333, 35.33333, 36.0, 36.0)))), "47") | |
poly68 <- Polygons( | |
list(Polygon(cbind( | |
c(140.0, 140.0, 141.0, 141.0, 140.0), | |
c(35.33333, 34.66666, 34.66666, 35.33333, 35.33333)))), "48") | |
poly69 <- Polygons( | |
list(Polygon(cbind( | |
c(139.0, 139.0, 140.0, 140.0, 139.0), | |
c(40.66666, 40.0, 40.0, 40.66666, 40.66666)))), "49") | |
poly70 <- Polygons( | |
list(Polygon(cbind( | |
c(139.0, 139.0, 140.0, 140.0, 139.0), | |
c(40.0, 39.33333, 39.33333, 40.0, 40.0)))), "50") | |
poly71 <- Polygons( | |
list(Polygon(cbind( | |
c(139.0, 139.0, 140.0, 140.0, 139.0), | |
c(39.33333, 38.66666, 38.66666, 39.33333, 39.33333)))), "51") | |
poly72 <- Polygons( | |
list(Polygon(cbind( | |
c(139.0, 139.0, 140.0, 140.0, 139.0), | |
c(38.66666, 38.0, 38.0, 38.66666, 38.66666)))), "52") | |
poly73 <- Polygons( | |
list(Polygon(cbind( | |
c(139.0, 139.0, 140.0, 140.0, 139.0), | |
c(38.0, 37.33333, 37.33333, 38.0, 38.0)))), "53") | |
poly74 <- Polygons( | |
list(Polygon(cbind( | |
c(139.0, 139.0, 140.0, 140.0, 139.0), | |
c(37.33333, 36.66666, 36.66666, 37.33333, 37.33333)))), "54") | |
poly75 <- Polygons( | |
list(Polygon(cbind( | |
c(139.0, 139.0, 140.0, 140.0, 139.0), | |
c(36.66666, 36.0, 36.0, 36.66666, 36.66666)))), "55") | |
poly76 <- Polygons( | |
list(Polygon(cbind( | |
c(139.0, 139.0, 140.0, 140.0, 139.0), | |
c(36.0, 35.33333, 35.33333, 36.0, 36.0)))), "56") | |
poly77 <- Polygons( | |
list(Polygon(cbind( | |
c(139.0, 139.0, 140.0, 140.0, 139.0), | |
c(35.33333, 34.66666, 34.66666, 35.33333, 35.33333)))), "57") | |
poly78 <- Polygons( | |
list(Polygon(cbind( | |
c(139.0, 139.0, 140.0, 140.0, 139.0), | |
c(34.66666, 34.0, 34.0, 34.66666, 34.66666)))), "58") | |
poly79 <- Polygons( | |
list(Polygon(cbind( | |
c(139.0, 139.0, 140.0, 140.0, 139.0), | |
c(34.0, 33.33333, 33.33333, 34.0, 34.0)))), "59") | |
poly80 <- Polygons( | |
list(Polygon(cbind( | |
c(138.0, 138.0, 139.0, 139.0, 138.0), | |
c(38.66666, 38.0, 38.0, 38.66666, 38.66666)))), "60") | |
poly81 <- Polygons( | |
list(Polygon(cbind( | |
c(138.0, 138.0, 139.0, 139.0, 138.0), | |
c(38.0, 37.33333, 37.33333, 38.0, 38.0)))), "61") | |
poly82 <- Polygons( | |
list(Polygon(cbind( | |
c(138.0, 138.0, 139.0, 139.0, 138.0), | |
c(37.33333, 36.66666, 36.66666, 37.33333, 37.33333)))), "62") | |
poly83 <- Polygons( | |
list(Polygon(cbind( | |
c(138.0, 138.0, 139.0, 139.0, 138.0), | |
c(36.66666, 36.0, 36.0, 36.66666, 36.66666)))), "63") | |
poly84 <- Polygons( | |
list(Polygon(cbind( | |
c(138.0, 138.0, 139.0, 139.0, 138.0), | |
c(36.0, 35.33333, 35.33333, 36.0, 36.0)))), "64") | |
poly85 <- Polygons( | |
list(Polygon(cbind( | |
c(138.0, 138.0, 139.0, 139.0, 138.0), | |
c(35.33333, 34.66666, 34.66666, 35.33333, 35.33333)))), "65") | |
poly86 <- Polygons( | |
list(Polygon(cbind( | |
c(138.0, 138.0, 139.0, 139.0, 138.0), | |
c(34.66666, 34.0, 34.0, 34.66666, 34.66666)))), "66") | |
#### | |
poly87 <- Polygons( | |
list(Polygon(cbind( | |
c(136.5, 136.5, 137.5, 137.5, 136.5), | |
c(38.0, 37.33333, 37.33333, 38.0, 38.0)))), "67") ##### | |
poly88 <- Polygons( | |
list(Polygon(cbind( | |
c(137.0, 137.0, 138.0, 138.0, 137.0), | |
c(37.33333, 36.66666, 36.66666, 37.33333, 37.33333)))), "68") | |
poly89 <- Polygons( | |
list(Polygon(cbind( | |
c(137.0, 137.0, 138.0, 138.0, 137.0), | |
c(36.66666, 36.0, 36.0, 36.66666, 36.66666)))), "69") | |
poly90 <- Polygons( | |
list(Polygon(cbind( | |
c(137.0, 137.0, 138.0, 138.0, 137.0), | |
c(36.0, 35.33333, 35.33333, 36.0, 36.0)))), "70") | |
poly91 <- Polygons( | |
list(Polygon(cbind( | |
c(137.0, 137.0, 138.0, 138.0, 137.0), | |
c(35.33333, 34.66666, 34.66666, 35.33333, 35.33333)))), "71") | |
poly92 <- Polygons( | |
list(Polygon(cbind( | |
c(137.0, 137.0, 138.0, 138.0, 137.0), | |
c(34.66666, 34.0, 34.0, 34.66666, 34.66666)))), "72") | |
poly93 <- Polygons( | |
list(Polygon(cbind( | |
c(136.0, 136.0, 137.0, 137.0, 136.0), | |
c(37.33333, 36.66666, 36.66666, 37.33333, 37.33333)))), "73") | |
poly94 <- Polygons( | |
list(Polygon(cbind( | |
c(136.0, 136.0, 137.0, 137.0, 136.0), | |
c(36.66666, 36.0, 36.0, 36.66666, 36.66666)))), "74") | |
poly95 <- Polygons( | |
list(Polygon(cbind( | |
c(136.0, 136.0, 137.0, 137.0, 136.0), | |
c(36.0, 35.33333, 35.33333, 36.0, 36.0)))), "75") | |
poly96 <- Polygons( | |
list(Polygon(cbind( | |
c(136.0, 136.0, 137.0, 137.0, 136.0), | |
c(35.33333, 34.66666, 34.66666, 35.33333, 35.33333)))), "76") | |
poly97 <- Polygons( | |
list(Polygon(cbind( | |
c(136.0, 136.0, 137.0, 137.0, 136.0), | |
c(34.66666, 34.0, 34.0, 34.66666, 34.66666)))), "77") | |
poly98 <- Polygons( | |
list(Polygon(cbind( | |
c(136.0, 136.0, 137.0, 137.0, 136.0), | |
c(34.0, 33.33333, 33.33333, 34.0, 34.0)))), "78") | |
poly99 <- Polygons( | |
list(Polygon(cbind( | |
c(135.0, 135.0, 136.0, 136.0, 135.0), | |
c(36.0, 35.33333, 35.33333, 36.0, 36.0)))), "79") | |
poly100 <- Polygons( | |
list(Polygon(cbind( | |
c(135.0, 135.0, 136.0, 136.0, 135.0), | |
c(35.33333, 34.66666, 34.66666, 35.33333, 35.33333)))), "80") | |
poly101 <- Polygons( | |
list(Polygon(cbind( | |
c(135.0, 135.0, 136.0, 136.0, 135.0), | |
c(34.66666, 34.0, 34.0, 34.66666, 34.66666)))), "81") | |
poly102 <- Polygons( | |
list(Polygon(cbind( | |
c(135.0, 135.0, 136.0, 136.0, 135.0), | |
c(34.0, 33.33333, 33.33333, 34.0, 34.0)))), "82") | |
poly103 <- Polygons( | |
list(Polygon(cbind( | |
c(134.0, 134.0, 135.0, 135.0, 134.0), | |
c(36.0, 35.33333, 35.33333, 36.0, 36.0)))), "83") | |
poly104 <- Polygons( | |
list(Polygon(cbind( | |
c(134.0, 134.0, 135.0, 135.0, 134.0), | |
c(35.33333, 34.66666, 34.66666, 35.33333, 35.33333)))), "84") | |
poly105 <- Polygons( | |
list(Polygon(cbind( | |
c(134.0, 134.0, 135.0, 135.0, 134.0), | |
c(34.66666, 34.0, 34.0, 34.66666, 34.66666)))), "85") | |
poly106 <- Polygons( | |
list(Polygon(cbind( | |
c(134.0, 134.0, 135.0, 135.0, 134.0), | |
c(34.0, 33.33333, 33.33333, 34.0, 34.0)))), "86") | |
poly107 <- Polygons( | |
list(Polygon(cbind( | |
c(133.0, 133.0, 134.0, 134.0, 133.0), | |
c(36.66666, 36.0, 36.0, 36.66666, 36.66666)))), "87") | |
poly108 <- Polygons( | |
list(Polygon(cbind( | |
c(133.0, 133.0, 134.0, 134.0, 133.0), | |
c(36.0, 35.33333, 35.33333, 36.0, 36.0)))), "88") | |
poly109 <- Polygons( | |
list(Polygon(cbind( | |
c(133.0, 133.0, 134.0, 134.0, 133.0), | |
c(35.33333, 34.66666, 34.66666, 35.33333, 35.33333)))), "89") | |
poly110 <- Polygons( | |
list(Polygon(cbind( | |
c(133.0, 133.0, 134.0, 134.0, 133.0), | |
c(34.66666, 34.0, 34.0, 34.66666, 34.66666)))), "90") | |
poly111 <- Polygons( | |
list(Polygon(cbind( | |
c(133.0, 133.0, 134.0, 134.0, 133.0), | |
c(34.0, 33.33333, 33.33333, 34.0, 34.0)))), "91") | |
poly112 <- Polygons( | |
list(Polygon(cbind( | |
c(133.0, 133.0, 134.0, 134.0, 133.0), | |
c(33.33333, 32.66666, 32.66666, 33.33333, 33.33333)))), "92") | |
poly113 <- Polygons( | |
list(Polygon(cbind( | |
c(132.0, 132.0, 133.0, 133.0, 132.0), | |
c(36.0, 35.33333, 35.33333, 36.0, 36.0)))), "93") | |
poly114 <- Polygons( | |
list(Polygon(cbind( | |
c(132.0, 132.0, 133.0, 133.0, 132.0), | |
c(35.33333, 34.66666, 34.66666, 35.33333, 35.33333)))), "94") | |
poly115 <- Polygons( | |
list(Polygon(cbind( | |
c(132.0, 132.0, 133.0, 133.0, 132.0), | |
c(34.66666, 34.0, 34.0, 34.66666, 34.66666)))), "95") | |
poly116 <- Polygons( | |
list(Polygon(cbind( | |
c(132.0, 132.0, 133.0, 133.0, 132.0), | |
c(34.0, 33.33333, 33.33333, 34.0, 34.0)))), "96") | |
poly117 <- Polygons( | |
list(Polygon(cbind( | |
c(132.0, 132.0, 133.0, 133.0, 132.0), | |
c(33.33333, 32.66666, 32.66666, 33.33333, 33.33333)))), "97") | |
poly118 <- Polygons( | |
list(Polygon(cbind( | |
c(131.0, 131.0, 132.0, 132.0, 131.0), | |
c(35.33333, 34.66666, 34.66666, 35.33333, 35.33333)))), "98") | |
poly119 <- Polygons( | |
list(Polygon(cbind( | |
c(131.0, 131.0, 132.0, 132.0, 131.0), | |
c(34.66666, 34.0, 34.0, 34.66666, 34.66666)))), "99") | |
poly120 <- Polygons( | |
list(Polygon(cbind( | |
c(131.0, 131.0, 132.0, 132.0, 131.0), | |
c(34.0, 33.33333, 33.33333, 34.0, 34.0)))), "100") | |
poly121 <- Polygons( | |
list(Polygon(cbind( | |
c(131.0, 131.0, 132.0, 132.0, 131.0), | |
c(33.33333, 32.66666, 32.66666, 33.33333, 33.33333)))), "101") | |
poly122 <- Polygons( | |
list(Polygon(cbind( | |
c(131.0, 131.0, 132.0, 132.0, 131.0), | |
c(32.66666, 32.0, 32.0, 32.66666, 32.66666)))), "102") | |
poly123 <- Polygons( | |
list(Polygon(cbind( | |
c(131.0, 131.0, 132.0, 132.0, 131.0), | |
c(32.0, 31.33333, 31.33333, 32.0, 32.0)))), "103") | |
poly124 <- Polygons( | |
list(Polygon(cbind( | |
c(130.0, 130.0, 131.0, 131.0, 130.0), | |
c(34.66666, 34.0, 34.0, 34.66666, 34.66666)))), "104") | |
poly125 <- Polygons( | |
list(Polygon(cbind( | |
c(130.0, 130.0, 131.0, 131.0, 130.0), | |
c(34.0, 33.33333, 33.33333, 34.0, 34.0)))), "105") | |
poly126 <- Polygons( | |
list(Polygon(cbind( | |
c(130.0, 130.0, 131.0, 131.0, 130.0), | |
c(33.33333, 32.66666, 32.66666, 33.33333, 33.33333)))), "106") | |
poly127 <- Polygons( | |
list(Polygon(cbind( | |
c(130.0, 130.0, 131.0, 131.0, 130.0), | |
c(32.66666, 32.0, 32.0, 32.66666, 32.66666)))), "107") | |
poly128 <- Polygons( | |
list(Polygon(cbind( | |
c(130.0, 130.0, 131.0, 131.0, 130.0), | |
c(32.0, 31.33333, 31.33333, 32.0, 32.0)))), "108") | |
poly129 <- Polygons( | |
list(Polygon(cbind( | |
c(130.0, 130.0, 131.0, 131.0, 130.0), | |
c(31.33333, 30.66666, 30.66666, 31.33333, 31.33333)))), "109") | |
poly130 <- Polygons( | |
list(Polygon(cbind( | |
c(129.0, 129.0, 130.0, 130.0, 129.0), | |
c(34.66666, 34.0, 34.0, 34.66666, 34.66666)))), "110") | |
poly131 <- Polygons( | |
list(Polygon(cbind( | |
c(129.0, 129.0, 130.0, 130.0, 129.0), | |
c(34.0, 33.33333, 33.33333, 34.0, 34.0)))), "111") | |
poly132 <- Polygons( | |
list(Polygon(cbind( | |
c(129.0, 129.0, 130.0, 130.0, 129.0), | |
c(33.33333, 32.66666, 32.66666, 33.33333, 33.33333)))), "112") | |
poly133 <- Polygons( | |
list(Polygon(cbind( | |
c(129.0, 129.0, 130.0, 130.0, 129.0), | |
c(32.66666, 32.0, 32.0, 32.66666, 32.66666)))), "113") | |
poly134 <- Polygons( | |
list(Polygon(cbind( | |
c(129.0, 129.0, 130.0, 130.0, 129.0), | |
c(32.0, 31.33333, 31.33333, 32.0, 32.0)))), "114") | |
poly135 <- Polygons( | |
list(Polygon(cbind( | |
c(129.0, 129.0, 130.0, 130.0, 129.0), | |
c(31.33333, 30.66666, 30.66666, 31.33333, 31.33333)))), "115") | |
poly136 <- Polygons( | |
list(Polygon(cbind( | |
c(128.0, 128.0, 129.0, 129.0, 128.0), | |
c(33.33333, 32.66666, 32.66666, 33.33333, 33.33333)))), "116") | |
poly137 <- Polygons( | |
list(Polygon(cbind( | |
c(128.0, 128.0, 129.0, 129.0, 128.0), | |
c(32.66666, 32.0, 32.0, 32.66666, 32.66666)))), "117") | |
poly141 <- Polygons( | |
list(Polygon(cbind( | |
c(139.0, 139.0, 140.0, 140.0, 139.0), | |
c(33.33333, 32.66666, 32.66666, 33.33333, 33.33333)))), "118") | |
poly153 <- Polygons( | |
list(Polygon(cbind( | |
c(130.0, 130.0, 131.0, 131.0, 130.0), | |
c(30.66666, 30.0, 30.0, 30.66666, 30.66666)))), "119") | |
poly154 <- Polygons( | |
list(Polygon(cbind( | |
c(129.0, 129.0, 130.0, 130.0, 129.0), | |
c(30.0, 29.33333, 29.33333, 30.0, 30.0)))), "120") | |
poly155 <- Polygons( | |
list(Polygon(cbind( | |
c(129.0, 129.0, 130.0, 130.0, 129.0), | |
c(29.33333, 28.66666, 28.66666, 29.33333, 29.33333)))), "121") | |
poly156 <- Polygons( | |
list(Polygon(cbind( | |
c(129.0, 129.0, 130.0, 130.0, 129.0), | |
c(28.66666, 28.0, 28.0, 28.66666, 28.66666)))), "122") | |
poly157 <- Polygons( | |
list(Polygon(cbind( | |
c(128.0, 128.0, 129.0, 129.0, 128.0), | |
c(28.0, 27.33333, 27.33333, 28.0, 28.0)))), "123") | |
poly158 <- Polygons( | |
list(Polygon(cbind( | |
c(127.5, 127.5, 128.5, 128.5, 127.5), | |
c(27.33333, 26.66666, 26.66666, 27.33333, 27.33333)))), "124") | |
poly161 <- Polygons( | |
list(Polygon(cbind( | |
c(127.5, 127.5, 128.5, 128.5, 127.5), | |
c(26.66666, 26.0, 26.0, 26.66666, 26.66666)))), "125") | |
poly162 <- Polygons( | |
list(Polygon(cbind( | |
c(126.5, 126.5, 127.5, 127.5, 126.5), | |
c(26.66666, 26.0, 26.0, 26.66666, 26.66666)))), "126") | |
poly163 <- Polygons( | |
list(Polygon(cbind( | |
c(124.5, 124.5, 125.5, 125.5, 124.5), | |
c(25.0, 24.33333, 24.33333, 25.0, 25.0)))), "127") | |
poly164 <- Polygons( | |
list(Polygon(cbind( | |
c(123.0, 123.0, 124.0, 124.0, 123.0), | |
c(26.0, 25.33333, 25.33333, 26.0, 26.0)))), "128") | |
poly166 <- Polygons( | |
list(Polygon(cbind( | |
c(123.5, 123.5, 124.5, 124.5, 123.5), | |
c(24.66666, 24.0, 24.0, 24.66666, 24.66666)))), "129") | |
poly170 <- Polygons( | |
list(Polygon(cbind( | |
c(142.0, 142.0, 143.0, 143.0, 142.0), | |
c(27.33333, 26.66666, 26.66666, 27.33333, 27.33333)))), "130") | |
tmp <- SpatialPolygons(Srl = list(poly13, poly14, poly15, poly16, | |
poly25, poly26, poly27, poly28, poly29, | |
poly30, poly31, poly32, | |
poly33, poly34, poly35, poly36, | |
poly37, poly38, poly39, poly40, poly41, | |
poly42, poly43, poly44, poly45, poly46, poly47, poly48, | |
poly49, poly50, poly51, | |
poly52, poly53, | |
poly54, poly55, poly56, poly57, poly58, | |
poly59, poly60, poly61, poly62, poly63, poly64, poly65, poly66, poly67, poly68, | |
poly69, poly70, poly71, poly72, poly73, poly74, poly75, poly76, poly77, poly78, poly79, | |
poly80, poly81, poly82, poly83, poly84, poly85, poly86, | |
poly87, poly88, poly89, poly90, poly91, poly92, | |
poly93, poly94, poly95, poly96, poly97, poly98, | |
poly99, poly100, poly101, poly102, | |
poly103, poly104, poly105, poly106, | |
poly107, poly108, poly109, poly110, poly111, poly112, | |
poly113, poly114, poly115, poly116, poly117, | |
poly118, poly119, poly120, poly121, poly122, poly123, | |
poly124, poly125, poly126, poly127, poly128, poly129, | |
poly130, poly131, poly132, poly133, poly134, poly135, | |
poly136, poly137, | |
poly141, | |
poly153, poly154, poly155, poly156, poly157, poly158, poly161, poly162, | |
poly163, poly164, poly166, | |
poly170), | |
pO = 1:130) | |
SpatialPolygonsDataFrame(tmp, res[1:130, ]) %>% geojson_json(., geometry = "polygon") | |
# copy then paste to gist | |
# SpatialPolygonsDataFrame(tmp, res[1:130, ]) %>% geojson_json(.) %>% readOGR(., "OGRGeoJSON") %>% plot(.) | |
# make mapping data ------------------------------------------------------------ | |
set.seed(100) | |
res$dummy.data <- rgamma(nrow(res), shape = 5, scale = 20) | |
jp.map.data <- SpatialPolygonsDataFrame(tmp, res[1:130, ]) %>% geojson_json(.) %>% readOGR(., "OGRGeoJSON") | |
## ---- plot -------------------------------------------------------------------- | |
library(rgdal) | |
library(ggplot2) | |
library(rgeos) | |
# use abobe map data from: https://gist.github.com/uribo/b09d642351c03dd975aa | |
url <- "https://gist.githubusercontent.com/uribo/b09d642351c03dd975aa/raw/96b36aee705814b6cf651dcf3a566be0b0f74803/japan_one_twenty_map.topojson" | |
readOGR(url, "OGRGeoJSON") %>% plot(.) | |
# ogrInfo(url, "OGRGeoJSON") | |
# labeling data with ggplot2 --------------------------------------------------- | |
jp.map <- readOGR(url, "OGRGeoJSON") %>% fortify(., region = "names.one.twenty") | |
centers <- readOGR(url, "OGRGeoJSON") %>% | |
gCentroid(., byid = TRUE) %>% | |
data.frame(., id = jp.map.data@data$names.one.twenty) %>% | |
cbind.data.frame() | |
ggplot() + | |
geom_map(data = jp.map, map = jp.map, | |
aes(x = long, y = lat, map_id = id), | |
color = "white", size = 0.5) + | |
geom_map(data = jp.map.data@data, map = jp.map, | |
aes(fill = dummy.data, map_id = names.one.twenty)) + | |
geom_map(data = jp.map.data@data, map = jp.map, | |
aes(map_id = names.one.twenty), | |
fill = "#ffffff", alpha = 0, color = "white", | |
show_guide = FALSE) + | |
scale_fill_distiller(palette = "RdPu", na.value = "#7f7f7f") + | |
geom_text(data = centers, | |
aes(label = id, x = x, y = y), color = "white", size = 2) + | |
coord_map() + | |
labs(x = NULL, y = NULL) + | |
theme_bw() + | |
theme(panel.border = element_blank()) |