def read_bounds(f, coord_size) -> mi.Rect: """Reads mercator bounds, returns (min_lon, min_lat, max_lon, max_lat).""" rmin = mwm_bitwise_split(read_varint(f)) rmax = mwm_bitwise_split(read_varint(f)) pmin = to_4326(coord_size, rmin) pmax = to_4326(coord_size, rmax) return mi.Rect(left_bottom=pmin, right_top=pmax)
def from_pygen_rect(r: geometry.RectD) -> mi.Rect: return mi.Rect(from_pygen_point(r.left_bottom), from_pygen_point(r.right_top))