PageSourceSearch

https://river.cat/js/map.js

js river.cat collected 2026-10-09 17:42:52 UTC 1,757 bytes, 62 lines download raw bytes

1function onEachFeature(feature, layer) {
2  // does this feature have a property named popupContent?
3  if (feature.properties && feature.properties.popupContent) {
4    layer.bindPopup(feature.properties.popupContent);
5  }
6}
7
8var min_zoom = 2;
9
10var bounds = L.latLngBounds(L.latLng(90, -180), L.latLng(-90, 180));
11var map = L.map('map', {
12  maxBounds: bounds,
13  zoomControl: false,
14  attributionControl: false,
15}
16               );
17
18//                          L.tileLayer.provider('Esri.WorldPhysical').addTo(map);
19//                          L.tileLayer.provider('Esri.OceanBasemap').addTo(map);
20
21/* Tiles designed and previously hosted by Stamen. They broke that, so now
22   pointing to archived copy at cooperhewitt museum. */
23L.tileLayer('https://watercolormaps.collection.cooperhewitt.org/tile/watercolor/{z}/{x}/{y}.jpg', {
24  maxZoom: 15,
25  minZoom: min_zoom,
26  noWrap: true,
27}).addTo(map);
28
29map.setView([55, -15], 3);
30L.geoJSON(geojson,
31          {
32            onEachFeature: onEachFeature
33          }).addTo(map);
34
35/*
36  Latitude: Positive is North, negative is South
37  Longitude: Positive is East, negative is West.
38
39  Coords are latitude first.
40*/
41var top_left     = [60, -90];
42var bottom_right = [6, 30];
43var bounds = [top_left, bottom_right];
44
45//map.fitBounds(bounds);
46//L.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(map);
47
48function setMinZoom() {
49  map.invalidateSize();
50  map.setMinZoom(min_zoom);
51  map.setZoom(min_zoom);
52  var zoom = map.getBoundsZoom([[90,-180],[-90,180]], true);
53  map.setMinZoom(zoom);
54//  console.log("Set minzoom to %d", zoom);
55}
56
57//window.addEventListener('resize', setMinZoom);
58
59const resizeObserver = new ResizeObserver(entries => {
60  setMinZoom();
61});
62resizeObserver.observe(document.querySelector('#map'));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.