{"id":2749,"date":"2013-04-17T09:21:03","date_gmt":"2013-04-17T00:21:03","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=2749"},"modified":"2013-12-29T23:06:20","modified_gmt":"2013-12-29T14:06:20","slug":"post-2749","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/node-js\/2749","title":{"rendered":"[node.js] Geocode\u30b5\u30fc\u30d3\u30b9\u3092\u4f7f\u3063\u305f\u4f4f\u6240\u2192\u7def\u5ea6\u7d4c\u5ea6\u5909\u63db\u51e6\u7406"},"content":{"rendered":"<p><a href=\"http:\/\/developer.yahoo.co.jp\/webapi\/map\/openlocalplatform\/v1\/geocoder.html\">Yahoo!\u30b8\u30aa\u30b3\u30fc\u30c0API<\/a>\u3092\u5229\u7528\u3057\u3066\u4f4f\u6240\u304b\u3089\u7def\u5ea6\u7d4c\u5ea6\u3092\u6c42\u3081\u308b\u30b9\u30cb\u30da\u30c3\u30c8\u3002<\/p>\n<p>\u6700\u521d\u306fGoogle\u306eGeocode\u30b5\u30fc\u30d3\u30b9\u3092\u4f7f\u3046\u4e88\u5b9a\u3060\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u5730\u56f3\u3092\u8868\u793a\u3057\u306a\u3044\u3067Geocode\u30b5\u30fc\u30d3\u30b9\u3060\u3051\u5229\u7528\u3059\u308b\u306e\u306f\u898f\u7d04\u9055\u53cd\u306b\u306a\u308b\u3089\u3057\u3044\u306e\u3067\u5374\u4e0b\u3002<\/p>\n<p><a href=\"https:\/\/developers.google.com\/maps\/documentation\/geocoding\/?hl=ja\">Google Geocoding API<\/a><\/p>\n<blockquote><p>Geocoding API \u306f Google \u30de\u30c3\u30d7\u4e0a\u306e\u7d50\u679c\u8868\u793a\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u5834\u5408\u306b\u306e\u307f\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002\u5730\u56f3\u306b\u8868\u793a\u305b\u305a\u306b\u30b8\u30aa\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u7d50\u679c\u3060\u3051\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u306f\u7981\u6b62\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p><\/blockquote>\n<p>Yahoo\u306eWeb API\u306e\u5229\u7528\u5236\u9650\u306b\u306f\u3001\u56de\u6570\u4ee5\u5916\u306e\u8a18\u8ff0\u304c\u306a\u3044\u306e\u3067\u308f\u304b\u3089\u306a\u3044\u3051\u308c\u3069\u3001\u3082\u3057\u304b\u3059\u308b\u3068\u5730\u56f3\u3092\u8868\u793a\u305b\u305a\u306b\u5909\u63db\u306b\u3060\u3051\u4f7f\u3046\u306e\u306f\u3053\u3063\u3061\u3082\u3060\u3081\u304b\u3082\u3002<\/p>\n<p><a href=\"http:\/\/developer.yahoo.co.jp\/appendix\/rate.html\">\u5229\u7528\u5236\u9650\u306b\u3064\u3044\u3066<\/a><\/p>\n<p>\u6012\u3089\u308c\u305f\u3089\u6d88\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:js decode:true \" >var request = require('request');\r\n\r\nvar geocodeURI = 'http:\/\/geo.search.olp.yahooapis.jp\/OpenLocalPlatform\/V1\/geoCoder?';\r\nvar address = process.argv[2];\r\nif(!address){\r\n    console.log('Not Found address')\r\n    return ;\r\n}\r\ngeocodeURI += &quot;&amp;appid=&quot; + &quot;\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3ID&quot;; \/\/Yahoo\u30c7\u30d9\u30ed\u30c3\u30d1\u30fc\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3067\u53d6\u5f97\r\ngeocodeURI += &quot;&amp;output=json&quot;;\r\ngeocodeURI += &quot;&amp;query=&quot; +encodeURI(address.toString(&quot;utf8&quot;));\r\n\r\nconsole.log(geocodeURI);\r\n\r\nrequest(geocodeURI, function (error, response, body) {\r\n  if (!error &amp;&amp; response.statusCode == 200) {\r\n    var  json = JSON.parse(body);\r\n    console.log(json)\r\n  }\r\n});<\/pre>\n<p>\u5b9f\u884c<\/p>\n<pre class=\"lang:sh decode:true \" >$ node geocode.js \u9ad8\u5d0e\u5e02<\/pre>\n<p>Yahoo!\u30b8\u30aa\u30b3\u30fc\u30c0API\u306f\u3001\u99c5\u3084\u30e9\u30f3\u30c9\u30de\u30fc\u30af\u306b\u306f\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044\u307f\u305f\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yahoo!\u30b8\u30aa\u30b3\u30fc\u30c0API\u3092\u5229\u7528\u3057\u3066\u4f4f\u6240\u304b\u3089\u7def\u5ea6&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-2749","post","type-post","status-publish","format-standard","hentry","category-node-js"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2749","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/comments?post=2749"}],"version-history":[{"count":1,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2749\/revisions"}],"predecessor-version":[{"id":2750,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2749\/revisions\/2750"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=2749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=2749"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=2749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}