If you're like me, your first thought on seeing these chained books was the restricted section of Hogwarts library. Especially the scene when Hermione helps Harry prepare for the Triwizard Tournament and notes the only reason Cho is interested in him is because Cho thinks Harry is the chosen one. "But I am," Harry replies. I was curious about the filming location and here is what I found:
"Hogwarts library and infirmary: Oxford University's famous Bodleian Library starred in 3 of the Harry Potter films. The medieval Duke Humfrey's Library was used as the Hogwarts library and the elaborate fan-vaulted Divinity School became Hogwart's infirmary."
So there you go. While not appearing in any of the Harry Potter films, the Hereford Cathedral Chained Library is nonetheless an medieval relic from times when security took a more brutish turn. Locking up books may seem medieval now (see what I did there?) it was top notch security at the time.
"A chain is attached at one end to the front cover of each book; the other end is slotted on to a rod running along the bottom of each shelf. The system allows a book to be taken from the shelf and read at the desk, but not to be removed from the bookcase. The books are shelved with their foredges, rather than their spines, facing the reader (the wrong way round to us); this allows the book to be lifted down and opened without needing to be turned around – thus avoiding tangling the chain."
Read more at http://www.atlasobscura.com/places/hereford-cathedral-chained-library