
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
@joergdietrich/leaflet.terminator
Advanced tools
Overlay day and night regions on a Leaflet Earth map.
Demo: http://joergdietrich.github.io/Leaflet.Terminator/
Leaflet.Terminator extends the Polygon class. Adding the terminator to a leaflet map is as easy as
<script src="https://unpkg.com/leaflet"></script>
<script src="https://unpkg.com/@joergdietrich/leaflet.terminator"></script>
var map = L.map('map').addLayer(L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'));
L.terminator().addTo(map)
Or with npm:
import L from 'leaflet';
import terminator from '@joergdietrich/leaflet.terminator';
var map = L.map('map').addLayer(L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'))
terminator().addTo(map);
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.
You can pass the time
option in the constructor or use the setTime()
method to control the reference time and date for the terminator; the
value can be anything accepted by the Date()
constructor. By default,
the current time will be used.
In the same way, you can use the setTime()
method without an argument
to refresh the terminator to the current time. This can be done
automatically, for example using a timer:
var map = L.map('map').addLayer(L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'));
var terminator = L.terminator().addTo(map);
setInterval(function() {
terminator.setTime();
}, 60000); // Every minute
If you don't like background timers running even when the page is inactive, you can also set the terminator to be refreshed only when the user interacts with the map:
var map = L.map('map').addLayer(L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'));
var terminator = L.terminator().addTo(map);
map.addEventListener('zoomstart movestart popupopen', function(e) {
terminator.setTime();
});
You can customize and complete this code by listing additional map interaction events, described in the Leaflet documentation.
FAQs
Night and day regions on Earth
The npm package @joergdietrich/leaflet.terminator receives a total of 1,120 weekly downloads. As such, @joergdietrich/leaflet.terminator popularity was classified as popular.
We found that @joergdietrich/leaflet.terminator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.