Hey Craig,

why not simply expose the geohash via the opennms rest api.
This would allow you to use the build in plugins.

The change should be applied to the OnmsGeolocation object:
https://github.com/OpenNMS/opennms/blob/9753e6af616828c62fefae0cbc5c3dc58c09b02f/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsGeolocation.java
 
<https://github.com/OpenNMS/opennms/blob/9753e6af616828c62fefae0cbc5c3dc58c09b02f/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsGeolocation.java>

I’d use this 3rd party API to generate the geohash:
https://github.com/davidmoten/geo <https://github.com/davidmoten/geo>
http://davidmoten.github.io/geo/apidocs/index.html 
<http://davidmoten.github.io/geo/apidocs/index.html> -> 
Geocode.encodeHash(double, double)

The change is probably something like this:

@XmlTransient
@Transient
public String asGeoHash() {
    if (m_longitude != null && m_latitude != null) {
        return Geocode.encodeHash(m_latitude, m_longitude);
    }
    return null;
}

Kind regards
- Markus

> On 19. Jun 2017, at 15:29, Craig Gallen (opennms) <cgal...@opennms.org> wrote:
> 
> Hi,
> 
> The stock grafana worldmap-panel allows data points to be displayed as
> circles of different sizes and colours on a world map. Unfortunately the
> original panel needs the data coordinates to be supplied as a geohash
> string which the OpenNMS data source cannot provide.
> 
> Without modifying the OpenNMS data source, I have forked the Grafana
> world map plugin and added the ability for it to work with latitude and
> longitude values from the OpenNMS Data source.
> 
> Applications for this feature are for instance showing wifi access point
> power levels in a map of the wifi points or plotting pollution
> measurements collected from geographically dispersed IoT sensors.
> 
> This version of the worldmap-panel requires each data value which is to
> be rendered as a circle to also have latitude and longitude values in
> the time series.  This can be easily achieved by adding a simple XML
> data collection service into the OpenNMS configuration which reads the
> latitude and longitude for a node from the asset table.
> 
> See
> https://github.com/gallenc/worldmap-panel
> 
> See also documentation at
> https://github.com/gallenc/worldmap-panel/blob/master/OpenNMS_Datasource.md
> 
> Please give it a try. Feedback welcome.
> 
> Craig
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! 
> http://sdm.link/slashdot_______________________________________________
> Please read the OpenNMS Mailing List FAQ:
> http://www.opennms.org/index.php/Mailing_List_FAQ
> 
> opennms-devel mailing list
> 
> To *unsubscribe* or change your subscription options, see the bottom of this 
> page:
> https://lists.sourceforge.net/lists/listinfo/opennms-devel

Attachment: signature.asc
Description: Message signed with OpenPGP

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this 
page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

Reply via email to