Help enabling Street Address to GPS Coordinates via Google Maps API

Hi All,

I setup a new LibreNMS server a few days ago. It’s working great, except, for the life of me, I cannot get street addresses to resolve to GPS Latitude, Longitude coordinates.

When setting up firewalls, we always input the street address into the Device Settings. LibreNMS is awesome and picks up this info via SNMP. So, for all our WatchGuard firewalls, we see the street address of the device show up in the LibreNMS “Location” field.

Addresses are always formatted as - “1000 Parkway Dr, Santa Clara, CA 95050”
(That’s not a real address, just an example)

We want to be able to see where the device is on a map in the LibreNMS Overview page. Meaning, we need these addresses to resolve to GPS coordinates that LibreNMS can use to place a pin on the map.

I’ve read through this guide a dozen times now - World Map - LibreNMS Docs

I setup LibreNMS with Bing Maps integration first since it was free, and that did not work. The map loaded fine, but addresses did not resolve to coordinates.
Then, I setup a Google Cloud Platform account with a working billing account, and generated an API key that has access to all of the 17 Google Maps API’s.

In both cases (Bing and Google), I can get the map to load, but the location does not show properly. The address is there, but no Lat / Lng values are resolved by LibreNMS.

Note that the screenshot is of a test linux box I setup in NMS. I set the street address in sysLocation Override. sysLocation Override does not resolve to coordinates, nor does the regular sysLocation as reported by SNMP devices.

Here is my config.php file:

Here are the results of me running daily.sh and validate.php as the librenms user:
root@nms-vm:/opt/librenms# su - librenms
librenms@nms-vm:~$ ./daily.sh
Fetching new release information OK
Updating to latest release OK
Updating Composer packages OK
Updating SQL-Schema OK
Updating submodules OK
Cleaning up DB OK
Fetching notifications OK
Caching PeeringDB data OK
librenms@nms-vm:~$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.66
DB Schema | 2020_07_29_143221_add_device_perf_index (172)
PHP | 7.4.3
Python | 3.8.2
MySQL | 10.3.22-MariaDB-1ubuntu1
RRDTool | 1.7.2
SNMP | NET-SNMP 5.8
====================================

[OK]    Composer Version: 1.10.10
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[WARN]  Your database schema has extra migrations (2020_07_29_143221_add_device_perf_index). If you just switched to the stable release from the daily release, your database is in between releases and this will be resolved with the next release.
[OK]    Database schema correct
librenms@nms-vm:~$

When setting up the new server, I installed Ubuntu Server 20.04.1 LTS, then followed the LibreNMS installation document, and lastly I followed the migration FAQ. I imported the database from an older LibreNMS server, and I copied the config files over, but everything else is new. I did not copy over the RRD files, so new graphs and RRD files have generated without issue.

I’m using Nginx, MariaDB and PHP 7.4.

Interestingly, I can see API hits happening in the Bing Maps developer portal, as well as in the Google Cloud Platform, so LibreNMS is definitely using the API. Also, with it set to the Google API like it is now, I can see the map data says “Copyright 2020 Google” which it did not originally. Originally, it was using the OpenMap data. But alas, street addresses do not resolve to coordinates no matter what I do.

Is there anything else I can try? I’d love to get this working.

Thanks,

Julian

Anyone know what I might be doing wrong with this one?

I’m having the same issues. If I override sysLocation with coordinates in square brackets, it will map. However, I can’t find a way to get a “properly formatted address” to map. I’m in Canada, but the addresses still drop a pin in the right spot when I search for them in Google/Bing.

Dean

In case this is helpful to anyone, I notice that the locations table in the database has no latitude or longitude values. Does this get entered on discovery or by the poller or when the map is called?

I found a work-around that works for our setup. If you go to Devices > Geo Locations > All locations, you can click the coordinates field to enter latitude and longitude manually. I just dropped a pin on Google maps for each of my locations and then copy and pasted. We only have 44 locations, so this was very doable for us. With larger installs, this isn’t practical. This was after previously spending hours logging into each device to standardize the format of the locations for consistency. The Geographical map now shows all our devices and most of the dependancies.

1 Like

Did you try this?

Of course you need to use your valid API key.

I had never seen this in the settings ui before… not sure why I couldn’t find it as I’ve combed through all the settings. I did however, set all three options in config.php:

$config[‘geoloc’][‘engine’] = “bing”;
$config[‘geoloc’][‘api_key’] = “*******”;
$config[‘geoloc’][‘latlng’] = “true”;

Perhaps the UI implements it’s settings differently than the config file (or I mistyped something!). :slight_smile:

I’ve removed my manually entered coordinates on a location after using the UI for my config settings and re-polled a device – the GeoLocation has now automatically been added.

Thank you, @murrant!

Probably a typo, glad you got it working.