{"id":752,"date":"2017-10-28T12:37:43","date_gmt":"2017-10-28T11:37:43","guid":{"rendered":"http:\/\/shippingworld-ng.com\/?page_id=752"},"modified":"2017-10-28T12:37:43","modified_gmt":"2017-10-28T11:37:43","slug":"testing-maps","status":"publish","type":"page","link":"https:\/\/shippingworld-ng.com\/index.php\/testing-maps\/","title":{"rendered":"testing maps"},"content":{"rendered":"<style>\n      \/* Always set the map height explicitly to define the size of the div<br \/>\n       * element that contains the map. *\/<br \/>\n      #map {<br \/>\n        height: 100%;<br \/>\n      }<br \/>\n      \/* Optional: Makes the sample page fill the window. *\/<br \/>\n      html, body {<br \/>\n        height: 100%;<br \/>\n        margin: 0;<br \/>\n        padding: 0;<br \/>\n      }<br \/>\n      #floating-panel {<br \/>\n        position: absolute;<br \/>\n        top: 10px;<br \/>\n        left: 25%;<br \/>\n        z-index: 5;<br \/>\n        background-color: #fff;<br \/>\n        padding: 5px;<br \/>\n        border: 1px solid #999;<br \/>\n        text-align: center;<br \/>\n        font-family: 'Roboto','sans-serif';<br \/>\n        line-height: 30px;<br \/>\n        padding-left: 10px;<br \/>\n      }<br \/>\n      #floating-panel {<br \/>\n        position: absolute;<br \/>\n        top: 5px;<br \/>\n        left: 50%;<br \/>\n        margin-left: -180px;<br \/>\n        width: 350px;<br \/>\n        z-index: 5;<br \/>\n        background-color: #fff;<br \/>\n        padding: 5px;<br \/>\n        border: 1px solid #999;<br \/>\n      }<br \/>\n      #latlng {<br \/>\n        width: 225px;<br \/>\n      }<br \/>\n    <\/style>\n<p>&nbsp;<\/p>\n<div id=\"floating-panel\"><input id=\"latlng\" type=\"text\" value=\"40.714224,-73.961452\" \/><br \/>\n<input id=\"submit\" type=\"button\" value=\"Reverse Geocode\" \/><\/div>\n<div id=\"map\"><\/div>\n<p><script>\n      function initMap() {\n        var map = new google.maps.Map(document.getElementById('map'), {\n          zoom: 8,\n          center: {lat: 40.731, lng: -73.997}\n        });\n        var geocoder = new google.maps.Geocoder;\n        var infowindow = new google.maps.InfoWindow;<\/p>\n<p>        document.getElementById('submit').addEventListener('click', function() {\n          geocodeLatLng(geocoder, map, infowindow);\n        });\n      }<\/p>\n<p>      function geocodeLatLng(geocoder, map, infowindow) {\n        var input = document.getElementById('latlng').value;\n        var latlngStr = input.split(',', 2);\n        var latlng = {lat: parseFloat(latlngStr[0]), lng: parseFloat(latlngStr[1])};\n        geocoder.geocode({'location': latlng}, function(results, status) {\n          if (status === 'OK') {\n            if (results[0]) {\n              map.setZoom(11);\n              var marker = new google.maps.Marker({\n                position: latlng,\n                map: map\n              });\n              infowindow.setContent(results[0].formatted_address);\n              infowindow.open(map, marker);\n            } else {\n              window.alert('No results found');\n            }\n          } else {\n            window.alert('Geocoder failed due to: ' + status);\n          }\n        });\n      }\n    <\/script><br \/>\n<script async defer src=\"https:\/\/maps.googleapis.com\/maps\/api\/js?key=YOUR_API_KEY&#038;callback=initMap\">\n    <\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; document.getElementById(&#8216;submit&#8217;).addEventListener(&#8216;click&#8217;, function() { geocodeLatLng(geocoder, map, infowindow); }); } function geocodeLatLng(geocoder, map, infowindow) { var input = document.getElementById(&#8216;latlng&#8217;).value; var latlngStr = input.split(&#8216;,&#8217;, 2); var latlng = {lat: parseFloat(latlngStr[0]), lng: parseFloat(latlngStr[1])}; geocoder.geocode({&#8216;location&#8217;: latlng}, function(results, status) { if (status === &#8216;OK&#8217;) { if (results[0]) { map.setZoom(11); var marker = new google.maps.Marker({ position: latlng, map: map }); infowindow.setContent(results[0].formatted_address); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-752","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/shippingworld-ng.com\/index.php\/wp-json\/wp\/v2\/pages\/752","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shippingworld-ng.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/shippingworld-ng.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/shippingworld-ng.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shippingworld-ng.com\/index.php\/wp-json\/wp\/v2\/comments?post=752"}],"version-history":[{"count":1,"href":"https:\/\/shippingworld-ng.com\/index.php\/wp-json\/wp\/v2\/pages\/752\/revisions"}],"predecessor-version":[{"id":753,"href":"https:\/\/shippingworld-ng.com\/index.php\/wp-json\/wp\/v2\/pages\/752\/revisions\/753"}],"wp:attachment":[{"href":"https:\/\/shippingworld-ng.com\/index.php\/wp-json\/wp\/v2\/media?parent=752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}