Skip to content

Instantly share code, notes, and snippets.

@yuskesuzki
Last active September 6, 2017 09:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuskesuzki/1c8c754f7237f06cac99 to your computer and use it in GitHub Desktop.
Save yuskesuzki/1c8c754f7237f06cac99 to your computer and use it in GitHub Desktop.
Leaflet.js imageoverlay sample no1
<html>
<head>
<meta charset="utf-8">
<style>
html,body{
margin: 0px;
padding: 0px;
}
#map {
width: 100%;
height: 100%;
}
</style>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
</head>
<body>
<div id="map"></div>
<script>
var map = L.map('map', {
maxZoom: 24,
minZoom: 1,
crs: L.CRS.Simple
}).setView([0, 0], 1);
map.setMaxBounds(new L.LatLngBounds([0,345], [230,0])); //表示可能範囲
var imageUrl = 'https://farm6.staticflickr.com/5495/9188725689_ac415ed0b5_h.jpg';
var imageBounds = [[230,0], [0,345]]; //初期表示範囲
L.imageOverlay(imageUrl, imageBounds, {
attribution:''
}).addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment