The logic is super simple to build the array for the geojson:

 

foreach ($GLOBALS['cache']['devices']['id'] as $device)

    {

      if (!$config['web_show_disabled'] && $device["disabled"]) { continue; }

      $lat = (is_numeric($device['location_lat']) ? $device['location_lat'] : $config['geocoding']['default']['lat']);

      $lon = (is_numeric($device['location_lon']) ? $device['location_lon'] : $config['geocoding']['default']['lon']);

      if ($device["status"] == "0")

      {

        if ($device["ignore"] == "0")

        {

          $locations[$lat][$lon]["down_hosts"][] = $device;

        }

      } else {

        $locations[$lat][$lon]["up_hosts"][] = $device;

      }

    }

 

We then iterate over each lat/lon pair and build the geojson entry for it. If the devices aren’t ending up in the same lat/lon pair, they probably don’t have the same lat/lon values.

 

Check the location information tab for the device in its settings, make sure the lat/lon coordinates match for all 3.

 

Adam.

 

From: observium <observium-bounces@observium.org> On Behalf Of Anthony Milazzo via observium
Sent: 21 January 2022 14:36
To: Observium <observium@observium.org>
Cc: Anthony Milazzo <amilazzo@gtweed.com>
Subject: Re: [Observium] Dashboard Map Device Count

 

Hi Adam

Yes, apologies for the lack of detail in my first email, but Markus described the issue perfectly.  The UP/Down count of devices per location is not always accurate on the dashboard map.

 

For example, in one of our sites, the map displays Up 4 devices, and Down 0

 

But the actual device list for that location is 84 Up and 2 down.

 

The location address is the same for all the devices at that site. 

 

 

Thanks

Tony

 

 

From: observium observium-bounces@observium.org On Behalf Of Markus Klock via observium
Sent: Friday, January 21, 2022 6:46 AM
To: Observium <observium@observium.org>
Cc: Markus Klock <markus@best-practice.se>
Subject: Re: [Observium] Dashboard Map Device Count

 

[CAUTION: EXTERNAL EMAIL]

If you hover over a location its number of devices up are not always correct.

Here my map shows 1 device up and 0 down but when I click on this location and get the list view:

It shows me that 3 devices have this location

 

/Markus

 

Den fre 21 jan. 2022 kl 10:24 skrev Adam Armstrong via observium <observium@observium.org>:

Hi,

 

It’s not quite clear what you’re comparing.

 

Adam.

Sent from my iPhone

 

On 20 Jan 2022, at 20:35, Anthony Milazzo via observium <observium@observium.org> wrote:



Hi

I’ve been having an issue with the number of devices per location not being correct when displayed on the Dashboard Map.  A few of our sites have the correct count, but most do not.  From the list view everything is ok.  The devices accessible and are set to a location that is geolocating to coordinates, but it’s like they’re not being counted properly. 

 

 

Thanks

Tony

 

_______________________________________________
observium mailing list
observium@observium.org
http://postman.memetic.org/cgi-bin/mailman/listinfo/observium

_______________________________________________
observium mailing list
observium@observium.org
http://postman.memetic.org/cgi-bin/mailman/listinfo/observium