Giter Club home page Giter Club logo

leaflet.utfgrid's Introduction

Leaflet.UTFGrid

Provides a UTFGrid implementation for Leaflet 1.0.

L.UTFGrid provides basic UTFGrid functionality including hover and click events.

L.UTFGridCanvas provides highlighting of areas using <canvas> tiles. Optionally can highlight entire feature, not just the portion of it within a single tile.

See the example.

Only supports Leaflet 1.0

Note: only supports browsers that provide canvas.

Usage

Requires corslite. This is included in L.UTFGrid-min.js

Include the JavaScript:

<script src="L.UTFGrid-min.js"></script>

Example usage:

var utfgrid = L.utfGrid(url, {
    resolution: 4,
    pointerCursor: true,
    mouseInterval: 66  // Delay for mousemove events
});
utfgrid.addTo(map);

utfgrid.on("mouseover", function(e){
    // DO SOMETHING
});

utfgrid.on("mouseout", function(e){
    // DO SOMETHING
});

utfgrid.on("click", function(e){
    // DO SOMETHING
});

Using <canvas> tiles:

var utfgrid = L.utfGridCanvas(url, {
    idField: 'ID',  // Expects UTFgrid to have a property 'ID' that indicates the feature ID
    buildIndex: true,  // requires above field to be set properly
    fillColor: 'black',
    shadowBlur: 0,  // Number of pixels for blur effect
    shadowColor: null,  // Color for shadow, if present.  Defaults to fillColor.
    debug: false  // if true, show tile borders and tile keys
});

Credits:

Developed with support from the South Atlantic Landscape Conservation Cooperative

Core implementation of UTFGrid based on ideas from Leaflet.utfgrid and heavily modified to extend Leaflet's builtin L.TileLayer.

Canvas implementation inspired by Mapbox Glower.

Contributors:

leaflet.utfgrid's People

Contributors

bjoernschilberg avatar brendan-ward avatar gusmacaulay avatar jvillafuerte avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.