Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Reverse Geocoding</title>
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      #map {
        height: 100%;
      #floating-panel {
        position: absolute;
        top: 10px;
        left: 25%;
        z-index: 5;
        background-color: #fff;
        padding: 5px;
        border: 1px solid #999;
        text-align: center;
        font-family: 'Roboto','sans-serif';
        line-height: 30px;
        padding-left: 10px;
      #floating-panel {
        position: absolute;
        top: 5px;
        left: 50%;
        margin-left: -180px;
        width: 350px;
        z-index: 5;
        background-color: #fff;
        padding: 5px;
        border: 1px solid #999;
      #latlng {
        width: 225px;
    <p id="konsolaHTML"></p>
    <p id="konsolaHTMLversion2"></p>
    <div id="floating-panel">
      <button onclick="whereAmI()">Where Am I?</button>
      <input id="submit" type="button" value="Show Me My Location">
    <div id="map"></div> 
/* PART 1 ----------------------------------------------------------------------------- */    
var sejf = "";
function whereAmI() {
var x = document.getElementById("konsolaHTML");
x.innerHTML = "Searching...";

function getLocation() {
    if (navigator.geolocation) {
    } else { 
        x.innerHTML = "Geolocation is not supported by this browser.";

function showPosition(position) {
    x.innerHTML = "Your location latitude: " + position.coords.latitude + 
    "<br>Your location longitude: " + position.coords.longitude;
      sejf = position.coords.latitude+","+position.coords.longitude;

/* PART 2 ----------------------------------------------------------------------------- */
      function initMap() {
        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 8,
          center: {lat: 40.731, lng: -73.997}
        var geocoder = new google.maps.Geocoder;
        var infowindow = new google.maps.InfoWindow;

        document.getElementById('submit').addEventListener('click', function() {
          geocodeLatLng(geocoder, map, infowindow);

      function geocodeLatLng(geocoder, map, infowindow) {
      console.log("INPUT: "+sejf);
        var input = sejf;
        var latlngStr = input.split(',', 2);
        var latlng = {lat: parseFloat(latlngStr[0]), lng: parseFloat(latlngStr[1])};
        geocoder.geocode({'location': latlng}, function(results, status) {
    if (status === google.maps.GeocoderStatus.OK) {
      if (results[1]) {
      /*START Edited by: Elminster White */
        console.log("PlaceID: "+results[1].place_id);
        console.log("Your location name: "+results[1].address_components[1].long_name+", "+results[1].address_components[5].long_name);
        var y = document.getElementById("konsolaHTMLversion2");
        y.innerHTML = "Your location name: "+results[1].address_components[1].long_name+", "+results[1].address_components[5].long_name;
      /*END Edited by: Elminster White */
      } else {
        window.alert('No results found');
    } else {
      window.alert('Geocoder failed due to: ' + status);
    <script async defer