Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Add and Remove Leaflet Circle on Click
<!DOCTYPE html>
<meta charset="utf-8">
<title>Click Circle</title>
<link rel="stylesheet" href="" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="" />
<script src=""></script>
<style type="text/css">
#map {
height: 500px;
<div id="map"></div>
<script type="text/javascript">
var map ='map', {
center: [33.8, -84.4],
zoom: 11
L.tileLayer('{z}/{x}/{y}.png', {
attribution: 'Map data &copy; <a href="">OpenStreetMap</a> contributors, <a href="">CC-BY-SA</a>, Imagery © <a href="">CloudMade</a>',
maxZoom: 18
// click circle:
var clickCircle;
function onMapClick(e) {
if (clickCircle != undefined) {
clickCircle =, 1609 * 3, {
color: '#f07300',
fillOpacity: 0,
opacity: 0.5
map.on('click', onMapClick);

What is 1609*3 value?

shanyuk commented Sep 24, 2017

How to remove lots circlemarks by one click?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment