• Stars
    star
    120
  • Rank 295,983 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 12 years ago
  • Updated 12 months ago

Reviews

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

Repository Details

Extend Leaflet's circle class to display semicircles.

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

More Repositories

1

django-tables2

django-tables2 - An app for creating HTML tables
Python
1,850
star
2

Leaflet.Sync

Synchronized view of two maps.
JavaScript
235
star
3

Leaflet.encoded

Plugin to support Google's polyline encoding in Leaflet.
JavaScript
176
star
4

leaflet-headless

Leaflet for node.
JavaScript
117
star
5

orc-data

Display/visualize some freely available ORC certificate sailboat data.
Svelte
72
star
6

python-lora

Decrypt LoRa payloads in python.
Python
67
star
7

leaflet.layerscontrol-minimap

Leaflet layers control with minimaps.
JavaScript
49
star
8

marinetraffic

Node module to use marinetraffic tracks.
JavaScript
26
star
9

leaflet-clonelayer

Clone leaflet layers
JavaScript
25
star
10

Leaflet.Grid

Displays a lat/lng grid overlay on Leaflet maps.
JavaScript
22
star
11

Leaflet.latlngcontrol

Show and edit the lat/lng for the center of a leaflet map
JavaScript
5
star
12

grunt-geojsonhint

Grunt task to run geojsonhint
JavaScript
3
star
13

chai-leaflet

Chai assertions to use with Leaflet map apps
JavaScript
3
star
14

fph-parser

Read Fisher & Paykel CPAP .FPH files.
Python
3
star
15

laser-gcode-swatch

Generate a series of paths at different feedrates / laser power, to check the effect of your CNC laser etcher on different materials.
JavaScript
3
star
16

f-engrave

Fork of f-engrave
Python
3
star
17

Compare-NewYork

Compare 1836 and modern New York
JavaScript
2
star
18

d3-legend

Simple legend for d3 using data-legend attributes on paths.
JavaScript
2
star
19

coconut-graph

Graph lib using d3
JavaScript
2
star
20

leaflet-layerscontrol-buttons

Leaflet layers control using a set of buttons.
CSS
2
star
21

saillogs

Stories about sailing in dutch.
JavaScript
2
star
22

rws2gpx

Rijkswaterstaat drijvende markeringen naar GPX converteren
HTML
2
star
23

svelte-django-gettext

Use Django's translation catalog in Svelte
JavaScript
2
star
24

NL-travel-advice

Travel advice from The Netherlands ministry of foreign affairs; JSON + map
JavaScript
1
star
25

NL-social-churches

Lijst van kerken in NL die actief zijn op social media met wat cijfertjes.
JavaScript
1
star