Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

L.CanvasDataLayer

Combined canvas and data loading layer for Leaflet.

There are several options for bitmap tile loading and also support for canvas tiles. This plugin combines a canvas tile layer wit XHR data tile loading.

Usage:

<!-- include the script after Leaflet.js -->
<script src="L.CanvasDataLayer.js"></script>
/**
 *initialization
 * @param {string} - url template to your data tile source
 * @param {object} - extra options, compatible with L.TileLayer.Canvas (http://leafletjs.com/reference.html#tilelayer-canvas)
 */
var layer = new L.CanvasDataLayer('http://geojson.example.com/{z}/{x}/{y}.json', {});

// implement a drawTile method
// @param {HTmlCanvasElement} - canvas of current tile
// @param {object} - coordinates { x,y,z } of current tile
// @param {string} - XMLHttpRequest.responseText
layer.drawTile = function(canvas, coords, responseText) {
  var geojson = JSON.parse(responseText);
  // draw commands...
};

About

📜 Combined canvas and data loading layer for Leaflet

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages