Repository navigation
Named layers, labels and basemap switching
Requested by the NetDet maps team, whose app had to work around these.
map.js - basemaps - maxNativeZoom (overzoom: tiles of that level are scaled up instead of left blank), labels (transparent label tiles over the base tiles, for satellite + labels = hybrid), {s}/{r}/{-y} in tile URLs with a subdomains option, and errorTiles for tiles that fail to load. New setTiles(id, tiles, options) swaps the basemap without recreating the map: layers, markers, the open popup and the view stay, and the old tiles stay until the new ones have loaded, so the map never blinks. Attribution reads "CrootJS | basemap | layer sources" (attributionPrefix: false drops the CrootJS part).
map.js - named layers, labels, hover - addGeoJSON options name, minZoom/maxZoom, order, visible, attribution, hoverStyle, tooltip, label + labelOptions. Labels sit at the point, the middle of a line or a polygon's centroid; colliding labels are hidden, top layer first. New showLayer, hideLayer, setLayerStyle, setLayerOrder, removeLayer, getLayers. Styles gain strokeDasharray, lineCap, lineJoin; fitMap padding may be per side.
mapmarker.js - anchor accepts top, left, right and the four corners, plus offset: [dx, dy].
mapcontrol.js - addBasemapControl (radio list calling setTiles) and addLayerControl (checkboxes for named layers), both with a collapsed mode.