There are a number of APIs for OpenStreetmap, e.g. via html request:
A json is returned. You can easily access the type of information you need.
I have not used the api for this particular purpose, but openstreetmap.org has very similar map data access.