In my experiences, coffee shops, even ones like Starbucks, are pretty lenient. I've spent 2-3 hours at them. As for the public library, the one nearest to me doesn't have WiFi, and I'd probably just be at home anyways if I'm that close, the one near my school makes me have a library card, and I don't feel like paying for it since I'm not actually located in the same city, and the next nearest one is over half an hour away. Plus, libraries don't serve coffee.
They're called public libraries. Quiet encouraged. Most have WiFi.
You're first problem is actually caring. I walk into coffee shops all the time and stay for a few hours while working on the road.