[Flow] Corona Virus - Map

@bakman2 your flow uses an endpoint /corona which while "obvious" to those of us who have been here before - is not the default /worldmap - so can be slightly hard to find if you don't just know :slight_smile:

But the link in the info tab is pointing correctly to the corona map (?).

@edwin - you have changed the original flow, if it does not work I cannot help.

I don't understand what you mean by corona map ??
This is what i see on the right screen
Maybe this program is too complicated for me

This is what I get when I start worldmap

ik stuur je een pm.

Try putting /corona instead of /worldmap on the end of the URL (just a guess - I haven't loaded the flow)

1 Like

Steve, you just beat me to suggesting putting /corona in the Dashboard view.
It works fine for me.
I need to be faster next time!!!

2 Likes

It works now.
I used http://127.0.0.1:1880/worldmap instead of http://127.0.0.1:1880/corona

1 Like

Hi,
I can see the map but without cirles on it! Probably i have to start the flow somehow but i don't know. Can you show me please ?

same here I could not get the circles shown

@pagkly @dpap

I have updated the flow. The dataset properties were changed which is why it couldnt find the correct data anymore.

Gist is not yet updated on flows page.
So for quick change, here's the function (the last one before map node)
I added also some fields..

Number.prototype.between = function(a, b) {
  var min = Math.min(a, b),
    max = Math.max(a, b);

  return this > min && this < max;
};

//////////

let m = msg.payload

let confirmed = m.Confirmed;
let deaths = m.Deaths
let country = m["Country_Region"]
let recovered = m.Recovered
let active = m.Active
let province = ""
if(m.hasOwnProperty("Province_State")){
    province = "("+m["Province_State"]+")"
} 
let lon = m.Long_
let lat = m.Lat
let c

if(confirmed>1000){
    c = "#D9100D"    
}
if(confirmed.between(750,1000)){
  c = "#D9340D"  
} 
if(confirmed.between(500,750)){
  c = "#D9590D"  
} 
if(confirmed.between(250,500)){
  c = "#D97D0D"  
} 
if(confirmed.between(100,250)){
  c = "#D9A20D"  
} 
if(confirmed.between(50,100)){
  c = "#D9B40D"  
} 
if(confirmed.between(1,50)){
  c = "#D3D408"  
} 
if(confirmed === 0){
  return
} 
    

let tooltip = `Country: ${country} ${province}<br/>Confirmed: ${confirmed}<br/>Deaths: ${deaths}<br/>Recovered: ${recovered}<br/>Active: ${active}`
let label = country +" "+province
return {payload:{name:label,lon:lon,lat:lat,popup:tooltip,"icon":"fa-circle",iconColor:c}}

Flow refreshed. (Forgot to do that) new field not included though.

Thanks! Now it works!

Update let line country = m["Country_Region"] to country = m["Admin2"]

Number.prototype.between = function(a, b) {
  var min = Math.min(a, b),
    max = Math.max(a, b);

  return this > min && this < max;
};

//////////

let m = msg.payload

let confirmed = m.Confirmed;
let deaths = m.Deaths
let country = m["Admin2"]
let recovered = m.Recovered
let active = m.Active
let province = ""
if(m.hasOwnProperty("Province_State")){
    province = "("+m["Province_State"]+")"
} 
let lon = m.Long_
let lat = m.Lat
let c

if(confirmed>1000){
    c = "#D9100D"    
}
if(confirmed.between(750,1000)){
  c = "#D9340D"  
} 
if(confirmed.between(500,750)){
  c = "#D9590D"  
} 
if(confirmed.between(250,500)){
  c = "#D97D0D"  
} 
if(confirmed.between(100,250)){
  c = "#D9A20D"  
} 
if(confirmed.between(50,100)){
  c = "#D9B40D"  
} 
if(confirmed.between(1,50)){
  c = "#D3D408"  
} 
if(confirmed === 0){
  return
} 
    

let tooltip = `Country: ${country} ${province}<br/>Confirmed: ${confirmed}<br/>Deaths: ${deaths}<br/>Recovered: ${recovered}<br/>Active: ${active}`
let label = country +" "+province
return {payload:{name:label,lon:lon,lat:lat,popup:tooltip,"icon":"fa-circle",iconColor:c}}

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