Skip to content

sanchezweezer/Leaflet.SmoothPolygons

Repository files navigation

Leaflet.SmoothPolygons

A simple and fast Leaflet canvas smooth polygons plugin. Uses paperJS under the hood to draw paths on canvas.

And we support flyTo event =)

Demo

Basic Usage

    npm i --save leaflet.smoothpolygons
import L from 'leaflet';
import 'leaflet.smoothpolygons';

const map = L.map(); // creates map

const polygonLayer = L.smoothPolygonsLayer().addTo(map);

const smoothPolygon = polygonLayer.addToScene({
  polygon: {
    data: [
      {
        Value, // Long on which it is necessary to recede from the center
        Direction // Angle from upper border by clock wise
      } // ,...
    ]
  },
  centralPoint: [lat, lng] // L.LanLng
});

To include the plugin, just use leaflet-smooth-poly.js from the dist folder:

<script src="leaflet-smooth-poly.js"></script>

Requirements

Reference

L.smoothPolygonsLayer(options)

Return Object of class

You can pass defaults option to all paths that you add.

L.smoothPolygonsLayer().addTo(map)

Connect with map and Constructs a canvas for polygons layer on map. All Options

Methods

  • setOptions(options): Sets new heatmap options and redraws it.
  • addLatLng(latlng): Adds a new point to the heatmap and redraws it.
  • setLatLngs(latlngs): Resets heatmap data and redraws it.
  • redraw(): Redraws the heatmap.

Changelog

1.0.0 — Dec 30, 2019

  • Initial release.

License

MIT License

About

Leaflet.js canvas layer with Paper.js vector smooth polygons

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published