{"id":3226,"date":"2013-12-26T08:48:26","date_gmt":"2013-12-25T23:48:26","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=3226"},"modified":"2017-02-03T01:19:42","modified_gmt":"2017-02-02T16:19:42","slug":"post-3226","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/google-map-api\/3226","title":{"rendered":"Google Map\u4e0a\u306b\u753b\u50cf\u3092\u914d\u7f6e\u3059\u308b"},"content":{"rendered":"<p><a href=\"http:\/\/shimz.me\/example\/gmapv3\/image\/takasaki\/\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/12\/gmapv3image.jpg\" alt=\"gmapv3image\" width=\"590\" height=\"279\" class=\"aligncenter size-full wp-image-3227\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/12\/gmapv3image.jpg 590w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/12\/gmapv3image-300x142.jpg 300w\" sizes=\"auto, (max-width: 590px) 100vw, 590px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/shimz.me\/example\/gmapv3\/image\/takasaki\/\">example<\/a><\/p>\n<p>\u7fa4\u99ac\u770c\u8b66\u5bdf\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u300c<span class=\"removed_link\" title=\"http:\/\/www.police.pref.gunma.jp\/seianbu\/01seiki\/hanzaimap\/map.html\">\u72af\u7f6a\u767a\u751f\u30de\u30c3\u30d7<\/span>(\u753b\u50cf)\u300d\u3092Google Map\u4e0a\u306b\u914d\u7f6e\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u9ad8\u5d0e\u8b66\u5bdf\u7f72\u7ba1\u5185\u306e\u300c\u4f4f\u5b85\u5bfe\u8c61\u4fb5\u5165\u7a83\u76d7(\u5e02\u8857\u306e\u30de\u30c3\u30d7)\u300d\u3092\u8868\u793a\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u753b\u50cf\u306e\u914d\u7f6e\u81ea\u4f53\u306f\u7c21\u5358\u306b\u884c\u3048\u308b\u306e\u3067\u3059\u304c\u3001\u4f4d\u7f6e\u3092\u3074\u3063\u305f\u308a\u5408\u308f\u305b\u308b\u306e\u304c\u96e3\u3057\u3044\u3067\u3059\u306d\u3002<\/p>\n<h2>\u30b5\u30f3\u30d7\u30eb<\/h2>\n<pre class=\"lang:js decode:true \" >function initialize() {\r\n    \/\/Google Maps API\u521d\u671f\u5316\r\n    geocoder = new google.maps.Geocoder();\r\n\t\tvar mapOptions = {\r\n\t\tzoom: 15,\r\n\t\tcenter: new google.maps.LatLng(36.3219088, 139.0032936),\r\n\t\tmapTypeId: google.maps.MapTypeId.ROADMAP\r\n    };\r\n    var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);\r\n\r\n    \/\/\u30de\u30c3\u30d7\u4e0a\u306e\u8868\u793a\u9818\u57df\u304c\u5909\u5316\u3057\u305f\u969b\u306e\u51e6\u7406\r\n    google.maps.event.addListener(map, 'bounds_changed', function() {\r\n\t\tvar latOutput = document.getElementById('lat');\r\n\t\tvar lngOutput = document.getElementById('lng');\r\n\r\n\t\t\r\n\t\tvar swlatOutput = document.getElementById('swlat');\r\n\t\tvar swlngOutput = document.getElementById('swlng');\r\n\t\t\r\n\t\t\/\/\u5317\u6771\u7def\u5ea6\u7d4c\u5ea6\u8868\u793a\u30a8\u30ec\u30e1\u30f3\u30c8\r\n\t\tvar nelatOutput = document.getElementById('nelat');\r\n\t\tvar nelngOutput = document.getElementById('nelng');\r\n\r\n\t\tvar latlngBounds = map.getBounds();\r\n\t\t\r\n\t\t\/\/\u30de\u30c3\u30d7\u4e2d\u5fc3\u306e\u7def\u5ea6\u7d4c\u5ea6\u53d6\u5f97\r\n\t\tvar centerLatlng = latlngBounds.getCenter();\r\n\t\tvar ceLat = centerLatlng.lat();\r\n\t\tvar ceLng = centerLatlng.lng();\r\n\t\t\r\n\t\tlatOutput.innerText = ceLat;\r\n\t\tlngOutput.innerText = ceLng;\r\n\t\t\r\n\t\t\/\/\u30de\u30c3\u30d7\u5357\u897f\u306e\u7def\u5ea6\u7d4c\u5ea6\u53d6\u5f97\r\n\t\tvar swLatlng = latlngBounds.getSouthWest();\r\n\t\tvar swlat = swLatlng.lat();\r\n\t\tvar swlng = swLatlng.lng();\r\n\t\tswlatOutput.innerText = swlat;\r\n\t\tswlngOutput.innerText = swlng;\r\n\r\n\t\t\/\/\u30de\u30c3\u30d7\u5317\u6771\u306e\u7def\u5ea6\u7d4c\u5ea6\u53d6\u5f97\r\n\t\tvar neLatlng = latlngBounds.getNorthEast();\r\n\t\tvar nelat = neLatlng.lat();\r\n\t\tvar nelng = neLatlng.lng();\t    \r\n\t\tnelatOutput.innerText = nelat;\r\n\t\tnelngOutput.innerText = nelng;\r\n    });\t\r\n    \r\n    var bounds = new google.maps.LatLngBounds();\r\n    \/\/\u753b\u50cf\u306e\u914d\u7f6e\u4f4d\u7f6e\u6307\u5b9a\r\n    bounds.extend(new google.maps.LatLng(36.3068070483715,138.95191292059326));\r\n    bounds.extend(new google.maps.LatLng(36.361153624185235,139.06435112249756));\r\n\r\n    \/\/\u753b\u50cf\u3092\u30b0\u30e9\u30a6\u30f3\u30c9\u30aa\u30fc\u30d0\u30fc\u30ec\u30a4\u3068\u3057\u3066\u8ffd\u52a0\r\n    var groundOverlay = new google.maps.GroundOverlay(\"http:\/\/www.police.pref.gunma.jp\/seianbu\/01seiki\/hanzaimap\/images\/jyutaku\/takasaki-s.jpg\", bounds, {\r\n\t\tmap : map,\r\n\t\topacity : 0.3,\r\n\t\tclickable : true\r\n    });\r\n    \r\n    \/\/\u5730\u56f3\u3092\u8868\u793a\r\n    map.fitBounds(bounds);\r\n    \r\n    \/\/\u30b0\u30e9\u30a6\u30f3\u30c9\u30aa\u30fc\u30d0\u30fc\u30ec\u30a4\u304c\u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u3089\u3001\u900f\u660e\u5ea6\u3092\u5909\u66f4\r\n    google.maps.event.addListener(groundOverlay, \"click\", toggle(show, hide));\t\r\n    function show(){\r\n\t\tgroundOverlay.setOpacity(1);\r\n    }\r\n    function hide(){\r\n\t\tgroundOverlay.setOpacity(0.5);\r\n    }\r\n}\r\n\r\n\r\ngoogle.maps.event.addDomListener(window, 'load', initialize);\r\n\r\n    \r\nfunction toggle(){\r\n    var fn = arguments;\r\n    var l = arguments.length;\r\n    var i = 0;\r\n    return function(){\r\n\t\tif(l <= i) i=0;\r\n\t\tfn[i++]();            \r\n    }\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>example \u7fa4\u99ac\u770c\u8b66\u5bdf\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u300c\u72af\u7f6a\u767a&hellip;<\/p>\n","protected":false},"author":1,"featured_media":3227,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37],"tags":[],"class_list":["post-3226","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\/3226","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=3226"}],"version-history":[{"count":0,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/3226\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/3227"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=3226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=3226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=3226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}