/** * Returns the boundaries of an array of Marker objects * @param Marker[] $markers * @param float $margin * @return LatLngBounds * @throws \yii\base\InvalidParamException */ public static function getBoundsOfMarkers($markers, $margin = 0.0) { $coords = []; foreach ($markers as $marker) { if (!$marker instanceof Marker) { throw new InvalidParamException('"$markers" must be an array of "' . Marker::className() . '" objects'); } $coords[] = $marker->position; } return LatLngBounds::getBoundsOfCoordinates($coords, $margin); }
/** * @return LatLng|null */ public function getMarkersCenterCoordinates() { return Marker::getCenterOfMarkers($this->getMarkers()); }