Das wäre dann so
<?
// allgemeine Angaben zur Karte
$map = [];
$point = [
'lat' => GetValueFloat(17701 /*[Rasenmäher\Automower\letzter Breitengrad]*/),
'lng' => GetValueFloat(40825 /*[Rasenmäher\Automower\letzter Längengrad]*/),
];
// Zentrum der Karte
$map['center'] = $point;
// Optionen für google.maps.Map
$map_options = [
'zoom' => 20, // 1: World, 5: Landmass/continent, 10: City, 15: Streets, 20: Buildings
'tilt' => 0, // 0..45
'mapTypeId' => 'satellite', // roadmap, terrain, hybrid, satellite
];
$map['map_options'] = $map_options;
// Standard-Optionen für google.maps.InfoWindow
$infowindow_options = [
'maxWidth' => 200, // pixel
];
$map['infowindow_options'] = $infowindow_options;
// Karte mit Positionen
$markers = [];
a
$marker = [];
$marker_points = [];
$marker_points[0] = $point;
// Text eines Punktes für google.maps.InfoWindow
$marker_points[0]['info'] = GetValueFormatted(30160 /*[Rasenmäher\Automower\Aktivität]*/);
// Ican dazu
$activity = GetValueInteger(30160 /*[Rasenmäher\Automower\Aktivität]*/);
$activity_label = [ 'E', 'D', 'P', 'L', 'S', 'F', 'M' ];
$url = 'http://maps.google.com/mapfiles/kml/paddle/' . $activity_label[$activity + 1] . '.png';
// Optionen eines Punktes für google.maps.Marker
$marker_options = [
'icon' => [
'url' => $url,
'scaledSize' => [
'width' => 32,
'height' => 32
]
]
];
$marker['marker_options'] = $marker_options;
// GPS-Punkte
$marker['points'] = $marker_points;
$markers[] = $marker;
$map['markers'] = $markers;
// Karte mit verbundenen Punkten
$paths = [];
// Fahrten der letzten 3 Tage
$paths_color = [ '#FF4040', '#7B68EE', '#00FF00' ];
$dt = new DateTime(date('d.m.Y 00:00:00', time()));
$now = $dt->format('U');
for ($i = 2; $i >= 0; $i--) {
$from = $now - ($i * 24 * 60 * 60);
$until = $from + (24 * 60 * 60) - 1;
$values = AC_GetLoggedValues(17849 /*[Archive]*/, 54501 /*[Rasenmäher\Automower\Position]*/, $from, $until, 0);
$points = [];
foreach ($values as $value) {
$pos = json_decode($value['Value'], true);
$points[] = [
'lat' => $pos['latitude'],
'lng' => $pos['longitude'],
];
}
$path = [];
// GPS-Punkte
$path['points'] = $points;
// Optionen für google.maps.Polyline
$polyline_options = [
'strokeColor' => $paths_color[$i],
'strokeOpacity' => 1.0,
'strokeWeight' => 2,
];
$path['polyline_options'] = $polyline_options;
$paths[] = $path;
}
$map['paths'] = $paths;
$html = GoogleMaps_GenerateDynamicMap(44269 /*[GoogleMaps]*/, json_encode($map));
echo $html;
Achtung: bitte daran denken, das das über ein WebHook gehen muss, siehe auch das README.md und die Beispiele in im GoogleMaps-Modul.
Ich konnte damit auf jeden Fall 3 Tage darstellen. Es ist ja ein Punkt pro Minute, das sind bei mir ~170 Punkte/Tag, bei Dir entsprechend mehr.
Da bei GoogleMapsDynamic die Daten in der (vom WebHook) erzeugten HTML-Seite enthalten sind, dürfte es keine Begrenzung geben.
Ich habe mal in symcon/db geschaut, die Größe der Variable-Datei sind bei mir 42Kb für die letzten 3 Tage, also etwas 3Mb/Jahr (2,5h / Tag an 5 Tagen / Woche).