func CenterBoundsZoom(proj crs.ProjectTransformer, bounds geo.LatLngBounds, size geometry.Point, maxZoom float64) (geo.LatLng, float64) { // calculate our zoom zoom := BoundsZoom(proj, bounds, size, maxZoom) // convert to points swPoint := crs.LatLngToPoint(proj, bounds.SouthWest(), zoom) nePoint := crs.LatLngToPoint(proj, bounds.NorthEast(), zoom) // find center center := crs.PointToLatLng(proj, swPoint.Add(nePoint).DivideBy(2), zoom) return center, zoom }