New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

leaflet-semicircle

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaflet-semicircle

Draw semicircles on Leaflet maps

  • 2.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Leaflet-Semicircle.

Allows drawing semicircles on leaflet maps.

It's an extension of Leaflet's L.Circle, and behaves like L.Circle if the a semicircle of almost 360 degrees is displayed.

Updated for use with leaflet 1.1.0.

Provided classes:

Provided methods:

L.SemiCircle/ L.SemiCircleMarker
factories: L.semiCircle/L.SemiCircleMarker
Options:
startAngle: start angle of the semicircle
stopAngle: stop angle of the semicircle
Angles are defined like compass courses: 0 = north, 90 = east, etc.
L.SemiCircle.setStartAngle(angle)Set the start angle of the circle to angle and redraw.
L.Circle.setStopAngle(angle)Set the stop angle of the circle to angle and redraw.
L.Circle.setDirection(direction, size)Set the startAngle to direction - (0.5 * size) and the stopAngle to direction + (0.5 * size) and redraw.

Usage:

The plugin provides two ways to only display a part of the circle:

  1. Use the options map and set startAngle and stopAngle.
  2. Use setDirection(direction, size) to display a semicircle of size degrees at direction.

Example:

Live demo

Using options.startAngle and options.stopAngle:

L.semiCircle([51.5, -0.09], {
    radius: 500,
	startAngle: 45,
	stopAngle: 135
}).addTo(map);

Draw the same semicircle using setDirection(direction, size):

L.semiCircle([51.5, -0.09], {radius: 500})
	.setDirection(90, 90)
	.addTo(map);

Screenshot:

Live demo

Semicircles screenshot

Changelog

2.0.2 (2017-09-01)

  • Fixed #24: instance check for canvas renderer

2.0.1 (2017-07-22)

  • Fixed #14: Poleward displacement of circle center when radius is large.

2.0.0 (2017-07-09)

  • Changed the API to stand-alone classes rather than overwriting L.Circle with an extension of itself.
  • Added support for Leaflet 1.1.0

Keywords

FAQs

Package last updated on 03 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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