2017-12-07 08:08:31 -06:00
|
|
|
source: Extensions/World-Map.md
|
2018-10-27 23:04:34 +01:00
|
|
|
path: blob/master/doc/
|
2019-07-18 21:25:53 -05:00
|
|
|
|
2017-12-07 08:08:31 -06:00
|
|
|
# World Map Configuration
|
|
|
|
|
2019-07-18 21:25:53 -05:00
|
|
|
LibreNMS comes with a configurable Geo Map based on World Map Widget
|
|
|
|
to visualize where your equipment is located geographically.
|
2017-12-07 08:08:31 -06:00
|
|
|
|
2019-07-18 21:25:53 -05:00
|
|
|
# World Map Widget
|
2017-12-07 08:08:31 -06:00
|
|
|
|
2019-07-18 21:25:53 -05:00
|
|
|
World Map Widget, requires you to have properly formatted addresses in
|
|
|
|
sysLocation or sysLocation override. As part of the standard poller
|
|
|
|
these addresses will be Geocoded by Google and stored in the database.
|
2017-12-07 08:08:31 -06:00
|
|
|
|
|
|
|
Location resolution happens as follows
|
2017-12-23 13:21:01 -06:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
1. If `device['location']` contains `[lat, lng]` (note the square
|
|
|
|
brackets), that is used
|
|
|
|
1. If there is a location overide for the device in the WebUI and it
|
|
|
|
contains `[lat, lng]` (note the square brackets), that is used.
|
|
|
|
1. Attempt to resolve lat, lng using `$config['geoloc']['engine']`
|
|
|
|
1. Properly formatted addresses in sysLocation or sysLocation
|
|
|
|
override, under device settings.
|
2017-12-07 08:08:31 -06:00
|
|
|
|
2017-12-23 13:21:01 -06:00
|
|
|
Example:
|
|
|
|
|
2020-12-30 09:38:14 -05:00
|
|
|
```
|
2017-12-23 13:21:01 -06:00
|
|
|
[40.424521, -86.912755]
|
2020-12-30 09:38:14 -05:00
|
|
|
```
|
2018-02-18 21:43:24 +01:00
|
|
|
|
2017-12-23 13:21:01 -06:00
|
|
|
or
|
2018-02-18 21:43:24 +01:00
|
|
|
|
2020-12-30 09:38:14 -05:00
|
|
|
```
|
2017-12-23 13:21:01 -06:00
|
|
|
1100 Congress Ave, Austin, TX 78701
|
2020-12-30 09:38:14 -05:00
|
|
|
```
|
2018-02-18 21:43:24 +01:00
|
|
|
|
2017-12-07 08:08:31 -06:00
|
|
|
We have two current mapping engines available:
|
|
|
|
|
|
|
|
- Leaflet (default)
|
|
|
|
- Jquery-Mapael
|
|
|
|
|
2019-07-18 21:25:53 -05:00
|
|
|
# World Map Widget Settings
|
2017-12-07 08:08:31 -06:00
|
|
|
|
2019-07-18 21:25:53 -05:00
|
|
|
- *Initial Latitude / Longitude*: The map will be centered on those
|
|
|
|
coordinates.
|
|
|
|
- *Initial Zoom*: Initial zoom of the map. [More information about
|
|
|
|
zoom levels](https://wiki.openstreetmap.org/wiki/Zoom_levels).
|
|
|
|
- *Grouping radius*: Markers are grouped by area. This value define
|
|
|
|
the maximum size of grouping areas.
|
2018-02-18 21:43:24 +01:00
|
|
|
- *Show devices*: Show devices based on there status.
|
|
|
|
|
2017-12-07 08:08:31 -06:00
|
|
|
Example Settings:
|
|
|
|
|
|
|
|

|
|
|
|
|
2019-07-18 21:25:53 -05:00
|
|
|
# Offline OpenStreet Map
|
2017-12-07 08:08:31 -06:00
|
|
|
|
2019-07-18 21:25:53 -05:00
|
|
|
If you can't access OpenStreet map directly you can run a local [tile
|
|
|
|
server](http://wiki.openstreetmap.org/wiki/Tile_servers). To specify a
|
|
|
|
different url you can set:
|
2017-12-07 08:08:31 -06:00
|
|
|
|
|
|
|
```php
|
|
|
|
$config['leaflet']['tile_url'] = 'localhost.com';
|
|
|
|
```
|
2019-07-18 21:25:53 -05:00
|
|
|
|
|
|
|
# Additional Leaflet config
|
|
|
|
|
2018-03-29 12:37:51 +02:00
|
|
|
```php
|
|
|
|
$config['map']['engine'] = "leaflet";
|
|
|
|
$config['leaflet']['default_lat'] = "51.981074";
|
|
|
|
$config['leaflet']['default_lng'] = "5.350342";
|
2019-09-09 05:48:35 -05:00
|
|
|
$config['leaflet']['default_zoom'] = 8;
|
|
|
|
// Device grouping radius in KM default 80KM
|
|
|
|
$config['leaflet']['group_radius'] = 1;
|
2018-03-29 12:37:51 +02:00
|
|
|
```
|
2017-12-07 08:08:31 -06:00
|
|
|
|
2019-07-18 21:25:53 -05:00
|
|
|
# Geocode engine config
|
|
|
|
|
2018-10-17 12:13:04 -04:00
|
|
|
```php
|
2018-11-10 17:10:45 -05:00
|
|
|
$config['geoloc']['engine'] = "google";// Valid options are google, mapquest or bing
|
2018-10-17 12:13:04 -04:00
|
|
|
$config['geoloc']['api_key'] = "abcdefghijklmnopqrstuvwxyz";
|
|
|
|
```
|
2019-07-18 21:25:53 -05:00
|
|
|
|
2018-11-17 18:14:04 -05:00
|
|
|
Google:
|
|
|
|
Pros: fast, accurate
|
2019-01-20 19:24:11 +01:00
|
|
|
Cons: requires a credit card even for a free account
|
2018-11-17 18:14:04 -05:00
|
|
|
|
|
|
|
MapQuest:
|
|
|
|
Pros: free, no credit card required
|
2019-01-20 19:24:11 +01:00
|
|
|
Cons: inaccurate: most addresses are returned as locations at the center of the US
|
2018-11-17 18:14:04 -05:00
|
|
|
|
|
|
|
Bing:
|
|
|
|
Pros: free, no credit card required, accurate
|
|
|
|
Cons: Microsoft(debatable)
|
|
|
|
|
2019-07-18 21:25:53 -05:00
|
|
|
# Jquery-Mapael config
|
|
|
|
|
|
|
|
Further custom options are available to load different maps of the
|
|
|
|
world, set default coordinates of where the map will zoom and the zoom
|
|
|
|
level by default. An example of this is:
|
2017-12-07 08:08:31 -06:00
|
|
|
|
|
|
|
```php
|
|
|
|
$config['map']['engine'] = "jquery-mapael";
|
|
|
|
$config['mapael']['default_map'] = 'mapael-maps/united_kingdom/united_kingdom.js';
|
|
|
|
$config['mapael']['map_width'] = 400;
|
|
|
|
$config['mapael']['default_lat'] = '50.898482';
|
|
|
|
$config['mapael']['default_lng'] = '-3.401402';
|
|
|
|
$config['mapael']['default_zoom'] = 20;
|
|
|
|
```
|
|
|
|
|
|
|
|
A list of maps can be found in ```html/js/maps/``` or ```html/js/mapael-maps/```.
|