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-tilelayer-swiss
Advanced tools
Leaflet.TileLayer.Swiss is a Leaflet plugin for displaying national maps of Switzerland using WMTS services of swisstopo.
Leaflet.TileLayer.Swiss is a Leaflet plugin for displaying national maps of Switzerland using WMTS services of swisstopo. This plugin is not affiliated with or endorsed by swisstopo.
Requires Leaflet, Proj4js, Proj4Leaflet. Tested with the versions listed as peerDependencies in package.json.
Most of the base map layers come with some usage restriction which is enforced by checking the HTTP Referer of map tile requests.
localhost
is always accepted as as a Referer.Most overlay layers are freely accessible, see list of layers and their accessiblity.
// Create a map with LV95 (EPSG:2056) CRS and default base map layer
var map = L.map('map', {
crs: L.TileLayer.Swiss.EPSG_2056,
layers: [L.tileLayer.swiss()],
maxBounds: L.TileLayer.Swiss.latLngBounds
});
// Center on EPSG:2056 coordinates [2600000, 1200000]
map.setView(L.TileLayer.Swiss.unproject_2056(L.point([2600000, 1200000])), 16);
Options are shown with their default values.
L.tileLayer.swiss({
// Coordinate reference system. EPSG_2056 and EPSG_21871 are available.
crs: L.TileLayer.Swiss.EPSG_2056
// Image format (jpeg or png). Only one format is available per layer.
format: 'jpeg',
// Layer name.
layer: 'ch.swisstopo.pixelkarte-farbe',
// Maximum zoom. Availability of zoom levels depends on the layer.
maxZoom: 27,
// Timestamp. Most (but not all) layers have a 'current' timestamp.
// Some layers have multiple timestamps.
timestamp: 'current'
});
A list with all available layers and corresponding options is available here.
Two CRS are commonly used in Switzerland:
In order to use EPSG:21781, both map and layer CRS have to be adapted:
var map = L.map('map', {
crs: L.TileLayer.Swiss.EPSG_21781,
layers: [L.tileLayer.swiss({
crs: L.TileLayer.Swiss.EPSG_21781
})],
maxBounds: L.TileLayer.Swiss.latLngBounds
});
map.setView(L.TileLayer.Swiss.unproject_21781(L.point([600000, 200000])), 16);
This plugin adds a map attribution which links to swisstopo, the same as it is done by the official swisstopo API.
The terms of service suggest the phrase "Source: Federal Topographical Office (agreement no.)", which you may want to use if you have an agreement number from swisstopo.
This plugin is licensed under the MIT license, see the LICENSE file.
Thanks to swisstopo and the Geoinformation Act for providing excellent geodata.
Thanks to @procrastinatio whose blog post taught me how to use swisstopo layers in Leaflet a few year ago.
FAQs
Leaflet.TileLayer.Swiss is a Leaflet plugin for displaying national maps of Switzerland using map tiles from Swisstopo.
The npm package leaflet-tilelayer-swiss receives a total of 127 weekly downloads. As such, leaflet-tilelayer-swiss popularity was classified as not popular.
We found that leaflet-tilelayer-swiss demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.