Skip to content

Instantly share code, notes, and snippets.

@oeon
Last active December 18, 2015 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oeon/5806713 to your computer and use it in GitHub Desktop.
Save oeon/5806713 to your computer and use it in GitHub Desktop.
PirateBox, OpenStreetMap/Leaflet html http://forum.daviddarts.com/read.php?2,6988
<!-- Source code by Gaël Musquet aka RatZillaS under WTFPL licence [http://www.wtfpl.net/] -->
<html>
<head>
<title>Embed OpenStreetMap on your PirateBox</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="OpenPirateMap/leaflet/dist/leaflet.css" />
<script type="text/javascript" src="OpenPirateMap/leaflet/dist/leaflet.js"></script>
<style>
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
}
</style>
</head>
<body>
<!-- Size of the map in pixel-->
<div id="map"></div>
<!-- Start of the leaflet javascript script-->
<script>
// Path name of tiles
var topo = L.tileLayer('http://piratebox.lan/Shared/OpenPirateMap/tiles_topo/{z}/{x}/{y}.png', { tms:false,
//MaxZoom
maxZoom: 14,
//MinZoom
minZoom: 10,
attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
});
var osm = L.tileLayer('http://piratebox.lan/Shared/OpenPirateMap/tiles_osm/{z}/{x}/{y}.png', { tms:false,
//MaxZoom
maxZoom: 14,
//MinZoom
minZoom: 10,
attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
});
// Set center of the map and default zoom
var map = L.map('map', {
center: new L.LatLng(35.23, -120.65),
zoom: 12,
layers: [topo, osm]
});
var baseMaps = {
"Topo": topo,
"OSM - MapQuest": osm
};
L.control.layers(baseMaps, null).addTo(map);
</script>
<!-- End of the leaflet javascript script-->
</body>
</html>
@oeon
Copy link
Author

oeon commented Jun 18, 2013

I renamed osm_onboard folder to OpenPirateMap. I also renamed/moved OSM_In_A_Box_beta.html to maptiles_offline.html and moved it up on level. Enabled layer switcher and mobile layout.

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