public static int GetZoomLevel(BoundingBox mapBoundingBox, double screenWidth, double screenHeight) { var scaleX = screenWidth / mapBoundingBox.Width; var scaleY = screenHeight / mapBoundingBox.Height; var screenSize = scaleX < scaleY ? screenWidth : screenHeight; return(WebMercatorUtility.EstimateZoomLevel(Math.Max(mapBoundingBox.Width, mapBoundingBox.Height), 35, screenSize)); }