public static function getNearestStations($stations, Coordinate $coordinatesRequest, int $radiusKM = 200)
    {
        //todo: make radius loadable from the config.
        DWDUtil::log(self::class, "Getting nearest stations from a list of " . count($stations) . ", around coordinates: " . $coordinatesRequest->format(new DecimalDegrees()));
        $calculator = new Vincenty();
        $nearestStations = array();

        foreach ($stations as $activeStation) {
            if (is_object($activeStation) && $activeStation instanceof DWDStation) {

                $coordinatesStation = new Coordinate($activeStation->getLatitude(), $activeStation->getLongitude());
                //distance in meters!
                $diff = $calculator->getDistance($coordinatesRequest, $coordinatesStation);
                if ($diff <= $radiusKM * DWDStationsController::kmToMeters) {
                    $nearestStations[intval($diff)] = $activeStation;

                }
                //sort by keys -> lowest distance first.
                ksort($nearestStations);
            }
        }
        DWDUtil::log(self::class, "Got nearest stations :" . count($nearestStations));
        if (count($nearestStations) < 1) {
            throw new DWDLibException("No Stations near the given Coordinates are available inside of a 200km radius around coordinates: " . $coordinatesRequest->format(new DecimalDegrees()));
        }
        return $nearestStations;

    }