{"id":2598,"date":"2013-02-22T19:09:40","date_gmt":"2013-02-22T10:09:40","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=2598"},"modified":"2017-02-03T01:19:29","modified_gmt":"2017-02-02T16:19:29","slug":"post-2598","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/google-map-api\/2598","title":{"rendered":"[GMaps API v3] \u30b9\u30c8\u30ea\u30fc\u30c8\u30d3\u30e5\u30fc\u3092\u4f7f\u3046\u3002"},"content":{"rendered":"<p><a href=\"http:\/\/shimz.me\/example\/gmapv3\/streetview\/01\/index.html\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/02\/streetview000000-e1361527646935.jpg\" alt=\"streetview000000\" width=\"559\" height=\"312\" class=\"aligncenter size-full wp-image-2599\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/02\/streetview000000-e1361527646935.jpg 559w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/02\/streetview000000-e1361527646935-269x150.jpg 269w\" sizes=\"auto, (max-width: 559px) 100vw, 559px\" \/><\/a><\/p>\n<p><span class=\"removed_link\" title=\"http:\/\/sankei.jp.msn.com\/region\/news\/130221\/gnm13022102210003-n1.htm\">\u30b9\u30c8\u30ea\u30fc\u30c8\u30d3\u30e5\u30fc\u3001\uff12\uff17\u5e02\u753a\u6751\u3082\u5bfe\u8c61\u306b\u3000\u30b0\u30fc\u30b0\u30eb\u3000\u7fa4\u99ac<\/span><\/p>\n<p>\u30b0\u30fc\u30b0\u30eb \u30b0\u30c3\u30b8\u30e7\u30d6! (\uffe3\u2207\uffe3\uff89\uff89&#8221;\uff8a\uff9f\uff81\uff8a\uff9f\uff81\uff8a\uff9f\uff81!!<\/p>\n<p>\u3053\u308c\u307e\u3067\u306f\u300c\u30b9\u30c8\u30d3\u30e5\u30fc\u306a\u3093\u3066\u4f7f\u3048\u308b\u306e\u306f\u3001\u6240\u8a6e\u4e00\u90e8\u306e\u90fd\u4f1a\u4eba\u3060\u3051\u300d\u3068\u624b\u3092\u51fa\u3055\u305a\u306b\u62d7\u306d\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u3053\u308c\u304b\u3089\u5fc3\u3092\u5165\u308c\u66ff\u3048\u3066\u52c9\u5f37\u3057\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u57fa\u672c\u304b\u3089\u3002<\/p>\n<pre class=\"lang:xhtml decode:true \" >&lt;!DOCTYPE HTML&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;title&gt;GMap Streetview example&lt;\/title&gt;\r\n&lt;script src=&quot;http:\/\/maps.googleapis.com\/maps\/api\/js?sensor=false&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;index.js&quot;&gt;&lt;\/script&gt;\r\n\r\n&lt;\/head&gt;\r\n&lt;body onload=&quot;initialize()&quot;&gt;\r\n&lt;h2&gt;GMap Streetview API\u3000\u30c6\u30b9\u30c8 &lt;\/h2&gt;\r\n&lt;div&gt;\r\n    &lt;div id=&quot;map_canvas&quot; style=&quot;float:left;width: 400px; height: 300px&quot;&gt;&lt;\/div&gt;\r\n    &lt;div id=&quot;pano&quot; style=&quot;width: 400px; height: 300px;&quot;&gt;&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n    &lt;div id=&quot;panoInfo&quot; style=&quot;width: 425px; height: 240 px;&quot;&gt;\r\n        &lt;table&gt;\r\n            &lt;tr&gt;\r\n                &lt;td&gt;&lt;b&gt;Position&lt;\/b&gt;&lt;\/td&gt;&lt;td id=&quot;position_cell&quot;&gt;&amp;nbsp;&lt;\/td&gt;\r\n            &lt;\/tr&gt;\r\n            &lt;tr&gt;\r\n                &lt;td&gt;&lt;b&gt;POV Heading&lt;\/b&gt;&lt;\/td&gt;&lt;td id=&quot;heading_cell&quot;&gt;270&lt;\/td&gt;\r\n            &lt;\/tr&gt;\r\n            &lt;tr&gt;\r\n                &lt;td&gt;&lt;b&gt;POV Pitch&lt;\/b&gt;&lt;\/td&gt;&lt;td id=&quot;pitch_cell&quot;&gt;0.0&lt;\/td&gt;\r\n            &lt;\/tr&gt;\r\n        &lt;\/table&gt;\r\n    &lt;\/div&gt;\r\n    &lt;input id=&quot;address&quot; type=&quot;textbox&quot; value=&quot;\u7fa4\u99ac\u770c\u524d\u6a4b\u5e02&quot;&gt;\r\n    &lt;input type=&quot;button&quot; value=&quot;\u691c\u7d22&quot; onclick=&quot;addressSearch()&quot;&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<pre class=\"lang:js decode:true \" >var map;\r\nvar geocoder = new google.maps.Geocoder();\r\nvar sv = new google.maps.StreetViewService();\r\nvar panorama;\r\n\r\n    \r\nfunction initialize() {\r\n    defPos = new google.maps.LatLng(36.322161, 139.00613099999998);\r\n    \r\n    \/\/\u5730\u56f3\u521d\u671f\u5316 \r\n    var mapOptions = {\r\n        center: defPos,\r\n        zoom: 14,\r\n        mapTypeId: google.maps.MapTypeId.ROADMAP\r\n    };\r\n    map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);\r\n\r\n    \/\/\u30b9\u30c8\u30ea\u30fc\u30c8\u30d3\u30e5\u30fc\u521d\u671f\u5316\r\n    var panoramaOptions = {\r\n        position: defPos,\r\n        pov: {\r\n            heading: 44,\r\n            pitch: 13\r\n        }\r\n    };  \r\n    panorama = new  google.maps.StreetViewPanorama(document.getElementById('pano'),panoramaOptions);\r\n    map.setStreetView(panorama);\r\n      \r\n  \r\n  \r\n    \/\/\u30b9\u30c8\u30ea\u30fc\u30c8\u30d3\u30e5\u30fc\u306beventListener\u767b\u9332\r\n    google.maps.event.addListener(panorama, 'position_changed', function() {\r\n        var positionCell = document.getElementById('position_cell');\r\n        positionCell.firstChild.nodeValue = panorama.getPosition();\r\n    });\r\n    google.maps.event.addListener(panorama, 'pov_changed', function() {\r\n        var headingCell = document.getElementById('heading_cell');\r\n        var pitchCell = document.getElementById('pitch_cell');\r\n        headingCell.firstChild.nodeValue = panorama.getPov().heading;\r\n        pitchCell.firstChild.nodeValue = panorama.getPov().pitch;\r\n    });     \r\n}\r\n\r\n\/\/\u691c\u7d22\r\nfunction addressSearch(){    \r\n    var address = document.getElementById('address').value;    \r\n    geocoder.geocode({ 'address': address}, function(results, status){\r\n        if(status == google.maps.GeocoderStatus.OK) {\r\n            map.setCenter(results[0].geometry.location); \/\/\u5730\u56f3\u79fb\u52d5\r\n            \r\n            sv.getPanoramaByLocation(    \/\/\u6307\u5b9a\u3055\u308c\u305f\u8efd\u5ea6\u7def\u5ea6\u4e0a\u306b\u30b9\u30c8\u30ea\u30fc\u30c8\u30d3\u30e5\u30fc\u304c\u5b58\u5728\u3059\u308b\u304b\u30c1\u30a7\u30c3\u30af\r\n                results[0].geometry.location,\r\n                500, \/\/\u691c\u7d22\u7bc4\u56f2(m)\r\n                function(svData,svStatus){\r\n                    if(svStatus == google.maps.StreetViewStatus.OK){\r\n                        panorama.setPosition(svData.location.latLng);    \/\/\u30b9\u30c8\u30ea\u30fc\u30c8\u30d3\u30e5\u30fc\u79fb\u52d5                        \r\n                    }else{\r\n                        alert(&quot;\u30b9\u30c8\u30ea\u30fc\u30c8\u30d3\u30e5\u30fc\u5bfe\u8c61\u5916\u306e\u5730\u57df\u3067\u3059\u3002&quot;)\r\n                    };\r\n                }\r\n            );\r\n        } else {\r\n             alert('\u5ea7\u6a19\u306e\u53d6\u5f97\u306b\u5931\u6557\u3057\u307e\u3057\u305f: ' + status);\r\n        }\r\n    });\r\n} \r\n<\/pre>\n<p><a href=\"http:\/\/shimz.me\/example\/gmapv3\/streetview\/01\/index.html\">example<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30b9\u30c8\u30ea\u30fc\u30c8\u30d3\u30e5\u30fc\u3001\uff12\uff17\u5e02\u753a\u6751\u3082\u5bfe\u8c61\u306b\u3000\u30b0\u30fc\u30b0\u30eb\u3000\u7fa4&hellip;<\/p>\n","protected":false},"author":1,"featured_media":2600,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37],"tags":[],"class_list":["post-2598","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-google-map-api","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2598","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=2598"}],"version-history":[{"count":1,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2598\/revisions"}],"predecessor-version":[{"id":3255,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2598\/revisions\/3255"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/2600"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=2598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=2598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=2598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}