• Stars
    star
    196
  • Rank 197,468 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 12 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A leaflet canvas layer for displaying large coverage data sets

Leaflet MaskCanvas

npm version

A leaflet canvas layer for displaying large coverage data sets.

Features:

  • Canvas tile layer based
  • High performance even for large dataset because of the QuadTree that is used internally
  • Custom color and circle size

Demo

Check out the demo at https://domoritz.github.io/vbb-coverage/.

Set up

NPM

npm install leaflet-maskcanvas

This library depends on leaflet >= 1.0, you can install it separately with npm i leaflet

Script

Clone or download the repository and use the files in src/ directly

<script src="QuadTree.js"></script>
<script src="L.TileLayer.MaskCanvas.js"></script>

Bower

bower install leaflet.maskcanvas

Usage

Initialize the maskCanvas layer

L.TileLayer.maskCanvas();

Set the dataset for the layer.

layer.setData(data);

Finally add the layer to the map.

map.addLayer(layer);

The data format is a simple array of [lat, lng] pairs. For example [[51.50,-0.28],[51.51,-0.07],[51.51,-0.07],[51.54,-0.29]]. I recommend that you load the data set asynchronously in order to keep the page responsive. Once the data is loaded, you can add it to the layer and display it.

Possible options

The MaskCanvas layer supports all Leaflet canvas layer options which can be passed to L.TileLayer.maskCanvas. You probably want to set the layer opacity.

Other possible options:

var layer = L.TileLayer.maskCanvas({
       radius: 5,  // radius in pixels or in meters (see useAbsoluteRadius)
       useAbsoluteRadius: true,  // true: r in meters, false: r in pixels
       color: '#000',  // the color of the layer
       opacity: 0.5,  // opacity of the not covered area
       noMask: false,  // true results in normal (filled) circled, instead masked circles
       lineColor: '#A00'   // color of the circle outline if noMask is true
});

Screenshot

screenshot

Developers

Run the demo locally with python -m SimpleHTTPServer and then open http://0.0.0.0:8000/demo. If you don't have python, but only npm you can also use npx http-server -p 8000 and go to http://localhost:8000/demo.

Acknowledgement

The QuadTree implementation comes from https://github.com/jsmarkus/ExamplesByMesh/tree/master/JavaScript/QuadTree and has been slightly modified. Original Implementation by Mike Chambers.

More Repositories

1

leaflet-locatecontrol

A leaflet control to geolocate the user.
JavaScript
732
star
2

arrow-tools

A collection of handy CLI tools to convert CSV and JSON to Apache Arrow and Parquet
Rust
145
star
3

streamlit-vega-lite

A Streamlit component to render interactive Vega, Vega-Lite, and Altair visualizations and access the selected data from Python
Python
90
star
4

csv2parquet

Convert CSV files to Apache Parquet.
Rust
72
star
5

arrow-wasm

Apache Arrow in WebAssembly
Rust
65
star
6

himawari-8-chrome

🛰 Experience the latest image from the Himawari, GOES, Meteosat, and DSCOVR satellites
TypeScript
56
star
7

json2parquet

Convert JSON files to Apache Parquet.
Rust
43
star
8

gameoflife-python

Conway's Game of Life in an infinite space implemented in Python
Python
41
star
9

open-mensa-android

Android OpenMensa Client, shows the meals for university canteens
Kotlin
40
star
10

label_generator

Training data generator for text detection
Python
38
star
11

clingo-wasm

Clingo on the web
TypeScript
32
star
12

streamlit-docker

Python
30
star
13

line-density

Fast heatmaps for massive time series.
TypeScript
29
star
14

domoritz.github.io

My homepage
JavaScript
22
star
15

json2arrow

Convert JSON files to Apache Arrow.
Rust
20
star
16

vbb-coverage

Visualization of the VBB data from http://daten.berlin.de/datensaetze/vbb-fahrplan2012
JavaScript
16
star
17

csv2arrow

Convert CSV files to Apache Arrow.
Rust
15
star
18

shorty

A minimal Python script to shorten DOIs in bibtex files
TeX
13
star
19

parquet-wasm

Rust
9
star
20

live-bus-seattle

Live bus map for seattle
JavaScript
9
star
21

D3-App-Template

A template for an interactive web application with D3
TypeScript
8
star
22

wasm-clingo

Clingo compiled for the web
HTML
7
star
23

S76D

Singing Very High Speed Integrated Circuit Hardware Description Language Board
VHDL
7
star
24

backbone-eventdata

This small backbone plugin allows you to pass eventData to your actions
JavaScript
6
star
25

random-csv

Generate a random CSV file
Python
6
star
26

breakfast

Friday breakfast
JavaScript
5
star
27

line-density-rust

Compute the density of time series with normalization
Rust
5
star
28

gameoflife-rust

Conway's Game of Life in an infinite space implemented in rust
Rust
4
star
29

SoSAT

SAT solver
Python
4
star
30

drummy

A drum recording software written in Qt/C++
C++
4
star
31

mosaic-motherduck

JavaScript
4
star
32

tvcg-journal-typst

A Typst template for TVCG journals
Typst
3
star
33

vis-csp

Visualization constraints with Answer Set Programming
Python
3
star
34

vis-grammar

A Visualization Grammar
TypeScript
3
star
35

summarization-go

Summarizing as I go
Go
3
star
36

gameoflife-swift

Conway's Game of Life in an infinite space implemented in Swift
Swift
3
star
37

seattlebusheatmap

Seattle bus concentration as heatmap
JavaScript
3
star
38

streamlit-vega-lite-demo

Demo for domoritz/streamlit-vega-lite.
Python
3
star
39

tree

Arduino Christmas Tree
C++
2
star
40

gameoflife-csharp

Conway's Game of Life in an infinite space implemented in C#
C#
2
star
41

vis-examples

Example visualizations in Vega and Vega-Lite
JavaScript
2
star
42

CSE512-reports

Reports for CSE 512
TeX
1
star
43

gameoflife-deno

TypeScript
1
star
44

assign-projects

Logic ASP program to calculate optimal placement of students in projects depending on a per student ranking.
Python
1
star
45

rust-alloc-test

JavaScript
1
star
46

gameoflife-go

Conway's Game of Life in an infinite space implemented in Golang
Go
1
star
47

informaticup-2012

Unser Beitrag zum Informaticup 2012
Python
1
star
48

Mensa-App

Android Apllication to get the canteen menu at the University of Potsdam.
Java
1
star
49

Professors

A Professors repository built on top of PopIt
JavaScript
1
star
50

vis-constraints

Vega-Lite and Compassql as constraints
TypeScript
1
star
51

pythonplot.com

📈 Interactive comparison of Python plotting libraries for exploratory data analysis. Examples of using Pandas plotting, plotnine, Seaborn, and Matplotlib.
Jupyter Notebook
1
star