\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 */\nfunction initMap() {\n const map = new google.maps.Map(document.getElementById(\"map\"), {\n zoom: 8,\n center: { lat: 63.333, lng: -150.5 },\n mapTypeId: \"terrain\",\n });\n const elevator = new google.maps.ElevationService();\n const infowindow = new google.maps.InfoWindow({});\n\n infowindow.open(map);\n // Add a listener for the click event. Display the elevation for the LatLng of\n // the click inside the infowindow.\n map.addListener(\"click\", (event) => {\n displayLocationElevation(event.latLng, elevator, infowindow);\n });\n}\n\nfunction displayLocationElevation(location, elevator, infowindow) {\n // Initiate the location request\n elevator\n .getElevationForLocations({\n locations: [location],\n })\n .then(({ results }) => {\n infowindow.setPosition(location);\n // Retrieve the first result\n if (results[0]) {\n // Open the infowindow indicating the elevation at the clicked position.\n infowindow.setContent(\n \"The elevation at this point
is \" +\n results[0].elevation +\n \" meters.\",\n );\n } else {\n infowindow.setContent(\"No results found\");\n }\n })\n .catch((e) =>\n infowindow.setContent(\"Elevation service failed due to: \" + e),\n );\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" }, 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 } Elevation Service - JSFiddle - Code Playground

JSFiddle