Last active
March 31, 2017 10:38
-
-
Save dbrugne/c1358e729de85043c595fd489602efd4 to your computer and use it in GitHub Desktop.
Google Maps with custom tile server overlay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
#map { | |
height: 430px; | |
position: relative; | |
width: 100%; | |
} | |
.maps-frame { | |
height: 430px; | |
width: 100%; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="map"></div> | |
<script> | |
function initMap() { | |
var map = new google.maps.Map(document.getElementById('map'), { | |
center: { lat: 48.994211, lng: 2.523297 }, | |
mapTypeId: google.maps.MapTypeId.HYBRID, | |
zoom: 12 | |
}); | |
// Add overlay from custom tile server | |
// @source: https://developers.google.com/maps/documentation/javascript/examples/map-projection-simple | |
var imageMapType = new google.maps.ImageMapType({ | |
getTileUrl: function(coord, zoom) { | |
return 'http://78.205.62.165:8080/Carro/' | |
+ zoom + '/' | |
+ coord.x + '/' | |
+ coord.y | |
+ '.png'; | |
} | |
}); | |
map.overlayMapTypes.push(imageMapType); | |
} | |
initMap(); | |
</script> | |
<script src="https://maps.googleapis.com/maps/api/js?key=__API_KEY__" async defer></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment