/// <summary> /// Due to limitations of certain CRS the given bounding box a/o size may be invalid. /// This happens when transforming Mercator tile bounds to the CRS. This helper checks /// the bounds and size. /// </summary> /// <param name="boundingBox"></param> /// <param name="size"></param> /// <returns>True, if bounds and size are valid.</returns> private static bool ParamsValid(IBoundingBox boundingBox, Size size) { return(size.Width > 0 && size.Width <= SizeLimit && size.Height > 0 && size.Height <= SizeLimit && boundingBox.Stream().All(dbl => !(double.IsInfinity(dbl) || double.IsNaN(dbl)))); }