# leaflet-semicircle

> Draw semicircles on Leaflet maps

Latest version **2.0.4** (published 2019-05-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install leaflet-semicircle
pnpm add leaflet-semicircle
yarn add leaflet-semicircle
bun add leaflet-semicircle
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2019-05-03 |
| First published | 2016-04-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 168.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 125 |
| Author | Jan Pieter Waagmeester |
| Maintainers | jieter |
| Keywords | leaflet, map, semicircle, piechart |

## Links

- npm: https://www.npmjs.com/package/leaflet-semicircle
- Repository: https://github.com/jieter/Leaflet-semicircle
- Homepage: https://github.com/jieter/Leaflet-semicircle#readme
- Issues: https://github.com/jieter/Leaflet-semicircle/issues
- npm.io page: https://npm.io/package/leaflet-semicircle

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 2.0.4 (latest) — 2019-05-03
- 2.0.3 — 2019-01-13
- 2.0.2 — 2017-09-01
- 2.0.1 — 2017-07-22
- 2.0.0 — 2017-07-09
- 1.0.6 — 2016-12-06
- 1.0.5 — 2016-05-10
- 1.0.4 — 2016-04-18
- 1.0.3 — 2016-04-17
- 1.0.2 — 2016-04-13

## README

Leaflet-Semicircle.
-------------------

Allows drawing semicircles on leaflet maps.

It's an extension of Leaflet's [`L.Circle`](http://leafletjs.com/reference-1.1.0.html#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: ##
<table>
<tr>
    <td>
        <code>L.SemiCircle</code>/
        <code>L.SemiCircleMarker</code><br />
        factories: <code>L.semiCircle</code>/<code>L.SemiCircleMarker</code>
    </td>
    <td>
        Options:<br />
        <code>startAngle</code>: start angle of the semicircle <br />
        <code>stopAngle</code>: stop angle of the semicircle<br />
        Angles are defined like compass courses: 0 = north, 90 = east, etc.
    </td>
</tr>

## Provided methods: ##
<table>
<tr>
    <td><code>L.SemiCircle.setStartAngle(angle)</code></td>
    <td>Set the start angle of the circle to <code>angle</code> and redraw.</td>
</tr>
<tr>
    <td><code>L.Circle.setStopAngle(angle)</code></td>
    <td>Set the stop angle of the circle to <code>angle</code> and redraw.</td>
</tr>
<tr>
    <td><code>L.Circle.setDirection(direction, size)</code></td>
    <td>Set the <code>startAngle</code> to <code>direction - (0.5 * size)</code> and the <code>stopAngle</code> to <code>direction + (0.5 * size)</code> and redraw.</td>
</tr>
</table>

## 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](http://jieter.github.com/Leaflet-semicircle/examples/semicircle.html)

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](http://jieter.github.com/Leaflet-semicircle/examples/semicircle.html)

![Semicircles screenshot](screenshot.png)

## 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

---
_Source: https://npm.io/package/leaflet-semicircle · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
