Skip to content

Canvas renderer, measuring, image overlays and PNG export

Choose a tag to compare

@github-actions github-actions released this 10 Nov 22:31
· 64 commits to main since this release

The rest of the NetDet maps brief: technical and survey maps.

map.js - canvas renderer and simplification - addGeoJSON(..., { renderer: "canvas" }) draws a layer on one canvas instead of one SVG element per shape; style (including dashes), popups, hoverStyle, tooltips, labels and onMapClick still work. 5,600 lines pan/zoom in less than half the time of SVG. simplify applies Douglas-Peucker per zoom level (a 2,000-point line becomes 36 points at zoom 10). New setZoomRange(id, minZoom, maxZoom).

maptools.js (new) - addMeasureControl / measure (distance and area by clicking points), addImageOverlay (georeferenced images by bounds + rotation, or three corners for rotate/scale/skew), and exportMapImage / downloadMapImage (PNG of the basemap, overlays, SVG and canvas layers, labels, markers, measurements, scale bar and attribution).

mapcontrol.js - addCoordinateControl (cursor coordinates, click to pin and copy, format hook for local grids) and addFullscreenButton (Fullscreen API, full-window fallback on iPhone Safari).

geomeasure.js - createAffineTransform(from, to) fits an affine transform from three or more control points (least squares), with inverse and RMS error: CAD grid or image pixels to [lng, lat] and back.