Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
leaflet-grid-distance
Advanced tools
AxesLayerWithDistance is a custom Leaflet grid layer that displays a customizable grid with labeled axes on a Leaflet map. This library allows you to visualize distance scales directly on your map tiles, enhancing the map's usability and interactivity for educational, scientific, or navigational purposes.
Install the package via npm:
npm install axes-layer-with-distance
First, import the library and Leaflet into your project:
import * as L from 'leaflet';
import { AxesLayer, AxesLayerOptions } from 'axes-layer-with-distance';
Here is a simple example of how to create a Leaflet map and add the AxesLayerWithDistance
:
// Create a map
const map = L.map('map').setView([51.505, -0.09], 13);
// Add a tile layer (e.g., OpenStreetMap)
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
}).addTo(map);
// Create an AxesLayer with options
const axesLayer = AxesLayer({
cells: 5,
color: '#40404044',
axesColor: '#ff6754',
axesWidth: 0.8,
zoom: 10,
showLabel: true,
defaultLabel: {
color: '#404040',
size: 13,
},
center: { lat: 51.505, lng: -0.09 },
});
// Add the AxesLayer to the map
axesLayer.addTo(map);
You can customize the AxesLayerWithDistance using the following options:
Here is a more advanced usage scenario, including event handling and dynamic updates:
// Create a map with an initial view
const map = L.map('map').setView([40.7128, -74.0060], 12);
// Add OpenStreetMap tile layer
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors',
maxZoom: 18,
}).addTo(map);
// Configure the AxesLayer options
const options = {
cells: 6,
color: '#00000044',
axesColor: '#008000',
axesWidth: 1.2,
zoom: 12,
showLabel: true,
defaultLabel: {
color: '#008000',
size: 14,
},
center: { lat: 40.7128, lng: -74.0060 },
};
// Initialize the AxesLayer
const axesLayer = AxesLayer(options);
// Add the AxesLayer to the map
axesLayer.addTo(map);
// Update the grid center dynamically
map.on('click', (event) => {
axesLayer.setCenter(event.latlng);
console.log('Grid center updated:', event.latlng);
});
We welcome contributions to improve this library. Please fork the repository, create a branch, and submit a pull request with your changes.
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions or support requests, please open an issue on the GitHub repository or contact me directly at techyared.main@gmail.com.
FAQs
A Leaflet plugin to show grid distances
The npm package leaflet-grid-distance receives a total of 1 weekly downloads. As such, leaflet-grid-distance popularity was classified as not popular.
We found that leaflet-grid-distance demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.