Skip to content

Instantly share code, notes, and snippets.

@zross
Created October 21, 2014 16:18

Revisions

  1. zross created this gist Oct 21, 2014.
    52 changes: 52 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,52 @@
    <!DOCTYPE html>
    <html>
    <head>
    <title>Place details</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <style>
    html, body, #map-canvas {
    height: 100%;
    margin: 0px;
    padding: 0px
    }
    </style>
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places"></script>
    <script>
    function initialize() {
    var map = new google.maps.Map(document.getElementById('map-canvas'), {
    center: new google.maps.LatLng(42.444508,-76.499491),
    zoom: 15
    });

    var request = {
    placeId: "ChIJT_x1AIOB0IkRhcd1YOHXJXk"
    };

    var infowindow = new google.maps.InfoWindow();
    var service = new google.maps.places.PlacesService(map);

    service.getDetails(request, function(place, status) {
    console.log(status)
    if (status == google.maps.places.PlacesServiceStatus.OK) {
    console.log(place)
    var marker = new google.maps.Marker({
    map: map,
    position: place.geometry.location
    });
    google.maps.event.addListener(marker, 'click', function() {
    infowindow.setContent(place.name);
    infowindow.open(map, this);
    });
    }
    });
    }

    google.maps.event.addDomListener(window, 'load', initialize);

    </script>
    </head>
    <body>
    <div id="map-canvas"></div>
    </body>
    </html>