Skip to content

Commit

Permalink
scatter marker position
Browse files Browse the repository at this point in the history
  • Loading branch information
DumbergerL committed Mar 18, 2024
1 parent a7c539f commit 7997e23
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion hdh-sensor-map/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,21 @@
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);

function scatter(value, maxValue){
const random = Math.random() * maxValue;
const delta = random - (maxValue / 2);
return value + delta;
}

var markerArray = window.LOCATION_DATA.map(sensorData => {
if(sensorData.latitude == null || sensorData.longitude == null){
return null;
}

var marker = L.marker([sensorData.latitude, sensorData.longitude]).addTo(map)
const latScatter = scatter(sensorData.latitude, 0.00009)
const lngScatter = scatter(sensorData.longitude, 0.00009)

var marker = L.marker([latScatter, lngScatter]).addTo(map)
marker.bindPopup("<b>" + sensorData.name + "</b><br>type: " + sensorData.type + "<br>labelIdentifier: <small>" + sensorData.labelIdentifier + "</small><br>groupIdentifier: <small>" + sensorData.groupIdentifier + "</small>").openPopup();

if(sensorData.type === 'BycicleBox'){
Expand Down

0 comments on commit 7997e23

Please sign in to comment.