Skip to content

Instantly share code, notes, and snippets.

@abovethewater
Forked from crofty/index.html
Last active December 17, 2015 10:59
Show Gist options
  • Save abovethewater/5598757 to your computer and use it in GitHub Desktop.
Save abovethewater/5598757 to your computer and use it in GitHub Desktop.
An example of using Google Map tiles with the Leaflet mapping library - http://matchingnotes.com/using-google-map-tiles-with-leaflet Forked from https://gist.github.com/crofty/2197701, updated to use latest leaflet from CDN - Issues with markers moving first when zooming.
<!DOCTYPE html>
<html>
<head>
<title>Leaflet</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.5/leaflet.js"></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
<script src="https://gist.github.com/bencevans/4504864/raw/c9ef880071f959398b7cf0b687d4f37c352ea86d/leaflet-google.js"></script>
</head>
<body>
<div style="width:500px; height:500px" id="map"></div>
<script type='text/javascript'>
var map = new L.Map('map', {center: new L.LatLng(51.51, -0.11), zoom: 9});
var googleLayer = new L.Google('ROADMAP');
map.addLayer(googleLayer);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment