/** * @param int $margin * @param int $default * * @return int */ public function getMarkersFittingZoom($margin = 0, $default = 14) { $markers = $this->getMarkers(); $bounds = LatLngBounds::getBoundsOfMarkers($markers, $margin); return $bounds->getZoom(min($this->width, $this->height), $default); }
/** * Returns the center coordinates of the boundaries of an array of Markers * * @param Marker[] $markers * * @return LatLng */ public static function getCenterCoordinates($markers) { $bounds = LatLngBounds::getBoundsOfMarkers($markers); return $bounds->getCenterCoordinates(); }