Hi all i have task to create monitoring of 200 ip addresses and for each of this ip we have location latitude/longitude. Now for the monitoring purpose i have perl script runing which pings all 200hosts and update their status in MySql database.
Now i want to display these 200 locations on google maps and change marker color depending on status Green = online, Red = offline.
Also i have loaded kml fille with location of the connections and street cabling ( This is fixed and no changes are needed )
How can i generate markers dynamically and display them all together with already loaded kml fille?
Or if there is any other solution i am willing to consider it.
Here is a sample where i am loading my kml fille:
JavaScript
x
47
47
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<title>KML Layers</title>
5
<script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
6
<script
7
src="https://maps.googleapis.com/maps/api/js?key=MY API&callback=initMap&libraries=&v=weekly"
8
defer
9
></script>
10
<style type="text/css">
11
/* Always set the map height explicitly to define the size of the div
12
* element that contains the map. */
13
#map {
14
height: 100%;
15
}
16
17
/* Optional: Makes the sample page fill the window. */
18
html,
19
body {
20
height: 100%;
21
margin: 0;
22
padding: 0;
23
}
24
</style>
25
<script>
26
"use strict";
27
28
function initMap() {
29
const map = new google.maps.Map(document.getElementById("map"), {
30
zoom: 12,
31
center: {
32
lat: 35.928926,
33
lng: 14.462688
34
}
35
});
36
const ctaLayer = new google.maps.KmlLayer({
37
url: "MY KML ADDRESS",
38
map: map
39
});
40
}
41
</script>
42
</head>
43
<body>
44
<div id="map"></div>
45
</body>
46
</html>
47
Advertisement
Answer
I ended up using MySql to Maps