Night and day regions on Earth
Switch branches/tags
Nothing to show
Clone or download
Latest commit 7310ed5 Jun 11, 2018


Overlay day and night regions on a Leaflet Earth map.


Leaflet.Terminator extends the Polygon class. Adding the terminator to a leaflet map is as easy as

<script src=""></script>
<script src=""></script>
var map ='map').addLayer(L.tileLayer('http://{s}{z}/{x}/{y}.png'));

Or with npm:

import L from 'leaflet';
import terminator from '@joergdietrich/leaflet.terminator';

var map ='map').addLayer(L.tileLayer('http://{s}{z}/{x}/{y}.png'))

In addition to all Polygon options, Leaflet.Terminator has a new option "resolution", which gives the step size at which the terminator points are computed. The step size is 1°/resolution, i.e. higher resolution values have smaller step sizes and more points in the polygon. The default value is 2.