Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ccabanero/6452027 to your computer and use it in GitHub Desktop.
Save ccabanero/6452027 to your computer and use it in GitHub Desktop.
TileStream - Sample code for adding a TileStream cache to Leaflet
<html>
<head>
<title>Sample: Adding TileStream cache to Leaflet</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" /><![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script>
$(document).ready(function(){
var map = new L.Map('map').setView([9.145, 40.489673], 5);
//change and supply your static ip and cache name
var tileLayer = L.tileLayer('http://1.2.3.4:8888/v2/MyCacheName/{z}/{x}/{y}.png',{opacity: 0.8});
map.addLayer(tileLayer);
});
</script>
</head>
<body>
<div id="map" style="width: 1000px; height: 750px"></div>
</body>
</html>
@balzer82
Copy link

Works! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment