Worldmap Heatmap Layer with Conditionals

Hi All, some help on working out how to do a heatmap layer needed please.

My original data looks like this:

[{
    "ID": 001,
    "Supplier": "Dredd Enterprises Inc.",
    "Contract": 2000,
    "Credit Score": "Secure",
    "location": {
        "longitude": -0.50000,
        "latitude": 52.0000
    }
}, {
    "ID": 002,
    "Supplier": "Ace Trucking Co",
    "Contract": 1000,
    "Credit Score": "Caution",
    "location": {
        "longitude": -0.60000,
        "latitude": 53.0000
    }
},{
    "ID": 003,
    "Supplier": "Angel Family Ltd",
    "Contract": 500,
    "Credit Score": "Caution",
    "location": {
        "longitude": -0.65000,
        "latitude": 53.5000
    }
}]

It will have a little transform using some JSONata to end up looking like this:

{
    "name": "Dredd Enterprises Inc.",
    "lat": 50.856563,
    "lon": -0.677288,
    "layer": "OSM",
    "icon": "map-marker",
    "iconColor": "purple"
}

My wish is that individual companies will have a heat indicator corresponding to the following:

IF Credit Score = Caution AND Contract >= 1000 THEN make heatIndicator Amber-ish
ELSE IF Credit Score = Caution AND Contract < 1000 THEN make heatIndicator Green-ish
ELSE IF Credit Score = Secure AND Contract >= 1000 THEN make heatIndicator Green-ish
ELSE IF Credit Score = Secure AND Contract >=2000 THEN make heatIndicator Amber-ish
etc.
ELSE make heatIndicator Amber-ish

...you get the idea.

I am not familiar with adding layers using commands for the Worldmap... and I can't find any particularly clear instructions on the heatmap.

Any assistance would be much appreciated!

d

currently the heatmap layer is designed to be triggered by the accumulation of traffic (ie points being updated on the map) - I'm not sure how to make it just add a blob of colour per se. You can of course just change the colour of the icons using the iconColor property.

(of course it may be possible but I've never looked or thought about it... so someone would need to do some digging to find out. - it uses this library under the covers - https://github.com/Leaflet/Leaflet.heat )

Ah. Hmm. That would make more sense.

I’ve already done the icon colour changes.

Since quite a few of these companies are in close proximity - I was hoping to show where there was particularly high “problematic spend” in a geographical area.

I can’t actually find any example of the heatmap, even for traffic. Were you able to find any examples?

BTW @dceejay - many thanks for all your work on this outstanding node! It is critically useful to us in our prototyping work (-:

1 Like

interesting other thread you linked to yesterday - maybe it is possible to drive as you wish - I'm always amazed how creative users are... - and am open to making it easier/better if we can work out the magic required.

Do you mean this one? If so, yes, that was why I was interested. Essentially, he is looking to display data in a similar way to me.

yes that was it

Haven't heard back from him yet!

I couldn't find any reference flows for the heatmap. Did you create any by any chance at any point please?

Hello, I am the author of the linked topic. To answer your question: unfortunately no, I did not make any progress, so for now I focus on other things I have to implement in nodered (I am using it for my bachelor's project). I am still looking for some solution though! If you implement this feature it would help me a lot!

Ah! OK. I shall try and work it out and let you know if I manage it!

Still trying to solve similar problems.

I have been trying to pull in the Council Administrative Boundaries as an overlay. I imagined I could pull it in using an overpass query such as this one.

However, I haven't been able to figure out if that is possible yet...and anyway it might be rather slow.

So I pulled in the data from that link as a JSON and attempted (more in hope than expectation!) to try to dump the whole JSON object into an overlay command thus:

msg.payload.command.map = {
    "overlay": "London Councils",
    "geojson": {scad loads of data...},
    "fit": true
};

And then I tried to inject that lot into the map...which of course failed as it was far too big...

So the question is... how would this be done better? Is it possible to pull in overlay data from (for instance) overpass. Or is this better done some other way completely!

Any help would be useful!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.