Skip to content

Clustering and live tracking

Choose a tag to compare

@awangga awangga released this 13 Oct 07:50
· 68 commits to main since this release

mapcluster.js (new) - addCluster(id, geojson, options?) draws the Point/MultiPoint features of very large datasets as count bubbles that split as the map zooms in. Grid clustering per zoom level, computed lazily, and only clusters in view get DOM elements, so 100,000 points pan smoothly. Options: radius, color, popup, onClick; returns remove().

mapcontrol.js - live tracking - trackUser(id, responseFunction?, options?) watches the position continuously and returns stop(); the callback gets { position, accuracy, speed, heading, timestamp } on every fix (speed m/s and heading degrees may be null), or null once if permission is denied. The map follows the position (options.follow, default true) until the user pans it manually. addTrackButton(id, responseFunction?, options?, corner?) is a toggle button for it.

map.js - onTap - onTap(element, fn) lets an overlay element handle its own tap: the map does not treat it as a map click and does not close the open popup, while a drag that starts on it still pans the map. The cluster bubbles are built on it.