\n
\n \n \n <\/div>\n
<\/div>\n\n \n <\/script>\n <\/body>\n<\/html>\n", js: "/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n// @ts-nocheck TODO remove when fixed\nfunction initMap() {\n const map = new google.maps.Map(document.getElementById(\"map\"), {\n zoom: 8,\n center: { lat: 40.731, lng: -73.997 },\n });\n const geocoder = new google.maps.Geocoder();\n const infowindow = new google.maps.InfoWindow();\n\n document.getElementById(\"submit\").addEventListener(\"click\", () => {\n geocodeLatLng(geocoder, map, infowindow);\n });\n}\n\nfunction geocodeLatLng(geocoder, map, infowindow) {\n const input = document.getElementById(\"latlng\").value;\n const latlngStr = input.split(\",\", 2);\n const latlng = {\n lat: parseFloat(latlngStr[0]),\n lng: parseFloat(latlngStr[1]),\n };\n\n geocoder\n .geocode({ location: latlng })\n .then((response) => {\n if (response.results[0]) {\n map.setZoom(11);\n\n const marker = new google.maps.Marker({\n position: latlng,\n map: map,\n });\n\n infowindow.setContent(response.results[0].formatted_address);\n infowindow.open(map, marker);\n } else {\n window.alert(\"No results found\");\n }\n })\n .catch((e) => window.alert(\"Geocoder failed due to: \" + e));\n}\n\nwindow.initMap = initMap;\n", css: "/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n/* \n * Always set the map height explicitly to define the size of the div element\n * that contains the map. \n */\n#map {\n height: 100%;\n}\n\n/* \n * Optional: Makes the sample page fill the window. \n */\nhtml,\nbody {\n height: 100%;\n margin: 0;\n padding: 0;\n}\n\n#floating-panel {\n position: absolute;\n top: 10px;\n left: 25%;\n z-index: 5;\n background-color: #fff;\n padding: 5px;\n border: 1px solid #999;\n text-align: center;\n font-family: \"Roboto\", \"sans-serif\";\n line-height: 30px;\n padding-left: 10px;\n}\n\n#floating-panel {\n position: absolute;\n top: 5px;\n left: 50%;\n margin-left: -180px;\n width: 350px;\n z-index: 5;\n background-color: #fff;\n padding: 5px;\n border: 1px solid #999;\n}\n\n#latlng {\n width: 225px;\n}\n\n" }, fiddle: { version: "", slug: "", boilerplate: false }, panels: { html: "html", js: "javascript", css: "css" }, user: { id: "None", username: "" }, currentUser: false, isAuthor: false, features: { toggleSidebar: false } } // translations const I18n = { editor: { panels: { result: "Result", drag_to_reorder: "Drag tabs to reorder", tidy: "Tidy" }, sidebar: { toggle_sidebar: "Toggle sidebar" }, groups: { placeholder_value: "Assign to groups", search_placeholder_value: "Search for groups", no_choices_text: "No more groups", no_results_text: "No groups found", item_select_text: "Press to select", you_have_no_groups: "You have no groups" } } } const EditorUISettings = { // options that user can change layout: 1, darkTheme: true, tabSize: 2, matchBrackets: true, lineNumbers: true, lineWrapping: true, keyMap: "default", autoCloseTags: true, autoCloseBrackets: true, indentWithTabs: false, codeLinting: true, autoRun: EditorConfig.currentUser ? false : false, autoRunValid: EditorConfig.currentUser ? true : false, autoSave: EditorConfig.currentUser ? true : false, clearConsole: false, fontSize: 1, matchTags: false, foldGutter: true, codeHints: true, editorConsole: true } Reverse Geocoding - JSFiddle - Code Playground

JSFiddle