2016-10-07 22:45:02 +08:00
|
|
|
---
|
|
|
|
layout: tutorial_frame
|
|
|
|
title: KittenLayer
|
|
|
|
---
|
|
|
|
<script type='text/javascript'>
|
|
|
|
|
|
|
|
var map = L.map('map', {
|
|
|
|
crs: L.CRS.Simple,
|
|
|
|
center: [0, 0],
|
|
|
|
zoom: 5
|
|
|
|
});
|
|
|
|
|
|
|
|
L.TileLayer.Kitten = L.TileLayer.extend({
|
|
|
|
getTileUrl: function(coords) {
|
|
|
|
var i = Math.ceil( Math.random() * 4 );
|
2018-05-04 20:21:43 +08:00
|
|
|
return "https://placekitten.com/256/256?image=" + i;
|
2016-10-07 22:45:02 +08:00
|
|
|
},
|
|
|
|
getAttribution: function() {
|
2018-05-04 20:21:43 +08:00
|
|
|
return "<a href='https://placekitten.com/attribution.html'>PlaceKitten</a>"
|
2016-10-07 22:45:02 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
L.tileLayer.kitten = function() {
|
|
|
|
return new L.TileLayer.Kitten();
|
|
|
|
}
|
|
|
|
|
|
|
|
map.addLayer( L.tileLayer.kitten() );
|
|
|
|
|
|
|
|
</script>
|