Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

leaflet-markers-canvas

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaflet-markers-canvas - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

licence.md

5

package.json
{
"name": "leaflet-markers-canvas",
"version": "0.1.0",
"version": "0.1.1",
"description": "Renders in Leaflet 1.0",

@@ -17,6 +17,5 @@ "main": "dist/leaflet-markers-canvas.min.js",

"authors": [
"Evgeniy Voynov <voynov.ev@gmail.com> (http://github.com/eJuke)",
"François Romain <francoisromain@gmail.com>"
],
"license": "Beerware",
"license": "AGPL-3.0-or-later",
"repository": {

@@ -23,0 +22,0 @@ "type": "git",

78

readme.md

@@ -5,2 +5,78 @@ # leaflet-markers-canvas

[Demo](https://francoisromain.github.io/leaflet-markers-canvas/examples/)
This is a complete rewrite of [Leaflet.Canvas-Markers](https://github.com/eJuke/Leaflet.Canvas-Markers) by Eugene Voynov. Thank you for the inspiration.
## Demo
Here is a [demo](https://francoisromain.github.io/leaflet-markers-canvas/examples/) of 10000 markers, displayed in one canvas.
## Basic usage
### Dependencies
[Leaflet](https://leafletjs.com/) and [RBush](https://github.com/mourner/rbush) must be available globally or installed as peer-dependencies.
### Install
Install from npm (`npm i leaflet-markers-canvas`) or download [leaflet-markers-canvas.js](https://github.com/francoisromain/leaflet-markers-canvas/blob/master/dist/leaflet-markers-canvas.js) from the dist folder.
```js
var map = L.map("map").setView([59.9578, 30.2987], 10);
var tiles = L.tileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png", {
attribution:
'&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
preferCanvas: true,
}).addTo(map);
var markersCanvas = new L.markersCanvas();
markersCanvas.addTo(map);
var icon = L.icon({
iconUrl: "marker.png",
iconSize: [20, 32],
iconAnchor: [10, 0],
});
var methods = {
mouseover(e) {
this.openPopup();
},
mouseout(e) {
this.closePopup();
},
};
var markers = [];
for (var i = 0; i < 10000; i++) {
var marker = L.marker(
[58.5578 + Math.random() * 1.8, 29.0087 + Math.random() * 3.6],
{ icon: icon }
)
.bindPopup("I Am " + i)
.on(methods);
markers.push(marker);
}
markersCanvas.addMarkers(markers);
```
## Methods
### `addTo(map)`
### `getBounds()`
### `redraw()`
### `clear()`
### `addMarker(marker)`
### `addMarkers(markers)`
### `removeMarker(marker)`
### To-do
- Complete documentation
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc