Yes I looked at generating a geohash but it isn't just the asset table, its is also collected latitude and longitude values which need converted and this would need to be done in the measurements api.
I wanted to provide a simple initial solution which would make as few changes as possible. The grafana world map and track map plug-ins expect a sequence of values each with a geohash. I enhanced them to support a sequence of values with latitude and longitude numbers as an alternative to geohashes so that the existing grafana opennms data source could be used without changes. This solution will work with existing OpenNMS implementations. An alternative would be to enhance the OpenNMS data source but this would also require changes to the measurements api which the Grafana OpenNMS data source uses. I looked initially at calculating a geohash in a jexl expression - using the library you referenced. However although jexl can deal with any object, the current measurements api can only return sequences of numbers and not strings and the asset table cannot be referenced easily from the measurement api code to import asset table values into jexl calculations. In short this seems to be the simplest solution to get something usable out there. Other people have been asking for latitude and longitude instead of just geohash data in the Grafana plugins so it is a generically useful feature. With feedback, we may want to revisit the opennms data source but that would be quite a lot of work. Cheers On 20-06-17 3:09 PM, Markus von Rüden wrote: > 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 > > > > 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 > > I’d use this 3rd party API to generate the geohash: > https://github.com/davidmoten/geo > 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 >> <mailto: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 > > > > ------------------------------------------------------------------------------ > 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 > ------------------------------------------------------------------------------ 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