map_view() html()
Rows with coordinates on one map (maps plugin): each row becomes a marker; clustered and fitted to the points.
html()->map_view($rows = [], $extra = [])Опції
| Опція | Значення |
|---|---|
$rows | List of arrays, e.g. a database result. |
lat_key, lng_key | Keys of the coordinates (default lat, lng); rows without a valid point are left out. |
title_key, popup_key | Tooltip and popup text (default title; the popup defaults to the title). |
other keys | Map spec keys of html()->map(): tiles, height, consent, cluster (on), fit (on), ... |
Приклад
Код
$rows = [
['name' => 'Kyiv', 'lat' => 50.4501, 'lng' => 30.5234],
['name' => 'Lviv', 'lat' => 49.8397, 'lng' => 24.0297],
['name' => 'Odesa', 'lat' => 46.4825, 'lng' => 30.7233],
['name' => 'Kharkiv', 'lat' => 49.9935, 'lng' => 36.2304],
];
return html()->map_view($rows, ['title_key' => 'name', 'tiles' => 'pmtiles', 'height' => 260]);Примітки
- At most yf_maps::$MAX_MARKERS markers (5000) go into the page; more points belong in a GIS layer (later phase).
Див. також: html/map