Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Display a Google Map using the Maps JavaScript API
#map_canvas {
height: 400px;
width: 600px;
border: 1px solid black;
<div id="map_canvas"></div>
<script src=""></script>
function initialize() {
var myLocation = {
'latitude': 48.858574,
'longitude': 2.294508,
'address': 'Eiffel Tower, Paris'
var myLatlng = new google.maps.LatLng( myLocation.latitude, myLocation.longitude );
var mapOptions = {
zoom: 16,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: myLocation.address
google.maps.event.addDomListener(window, 'load', initialize);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.