Merge pull request #12 from nakiabrewer/master
Addition of msg.payload.addtoheatmap and msg.payload.intensity
This commit is contained in:
commit
3618cb85fb
@ -46,6 +46,9 @@ Optional properties include
|
||||
- **iconColor** : Standard CSS color name or #rrggbb hex value.
|
||||
- **photoUrl** : adds an image pointed at by the url to the popup box.
|
||||
- **deleted** : set to <i>true</i> to remove the named marker. (default false)
|
||||
- **addtoheatmap** : set to <i>false</i> to exlcude point from contributing to heatmap layer. (default true)
|
||||
- **intensity** : set to a value of 0.1 - 1.0 to set the intensity of the point on heatmap layer. (default 1.0)
|
||||
|
||||
|
||||
Any other `msg.payload` properties will be added to the icon popup text box.
|
||||
|
||||
|
@ -712,8 +712,9 @@ var delMarker = function(dname) {
|
||||
|
||||
// the MAIN add something to map function
|
||||
function setMarker(data) {
|
||||
console.log(typeof data, data);
|
||||
//console.log(typeof data, data);
|
||||
var ll;
|
||||
var lli = null;
|
||||
var stay = popped;
|
||||
|
||||
var lay = data.layer || "not known";
|
||||
@ -774,6 +775,12 @@ function setMarker(data) {
|
||||
else if (data.hasOwnProperty("lat") && data.hasOwnProperty("lon")) { ll = new L.LatLng((data.lat*1), (data.lon*1)); }
|
||||
else if (data.hasOwnProperty("latitude") && data.hasOwnProperty("longitude")) { ll = new L.LatLng((data.latitude*1), (data.longitude*1)); }
|
||||
else { console.log("No location:",data); return; }
|
||||
// Adding new L.LatLng object (lli) when optional intensity value is defined. Only for use in heatmap layer
|
||||
if (typeof data.coordinates == "object") { lli = new L.LatLng(data.coordinates[2],data.coordinates[1],data.coordinates[0]); }
|
||||
else if (data.hasOwnProperty("lat") && data.hasOwnProperty("lon") && data.hasOwnProperty("intensity")) { lli = new L.LatLng((data.lat*1), (data.lon*1), (data.intensity*1)); }
|
||||
else if (data.hasOwnProperty("latitude") && data.hasOwnProperty("longitude") && data.hasOwnProperty("intensity")) { lli = new L.LatLng((data.latitude*1), (data.longitude*1), (data.intensity*1)); }
|
||||
else { lli = ll }
|
||||
|
||||
var words="<b>"+data.name+"</b><br/>";
|
||||
|
||||
// Create the icons... handle ship, earthquake as specials
|
||||
@ -889,8 +896,9 @@ function setMarker(data) {
|
||||
rightmenuMarker.setLatLng(e.latlng);
|
||||
map.openPopup(rightmenuMarker);
|
||||
});
|
||||
|
||||
if (heatAll || map.hasLayer(layers[lay])) { heat.addLatLng(ll); }
|
||||
if ((data.addtoheatmap !== "false") || (!data.hasOwnProperty("addtoheatmap"))){ // Added to give ability to control if points from active layer contribute to heatmap
|
||||
if (heatAll || map.hasLayer(layers[lay])) { heat.addLatLng(lli); }
|
||||
}
|
||||
markers[data.name] = marker;
|
||||
layers[lay].addLayer(marker);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user