I understand that what you ask for is not possible from the Google API. Reverse geocoding inside a polygon is not a service that they offer. There are several posts on other sites (e.g. https://gis.stackexchange.com/questions/22816/how-to-reverse-geocode-without-google ) with a gisgraphy.com link looks like a pretty neat reverse geocoding tool.
However, this still does not apply to all of your streets in the polygon problem. I think your only option is to get your data ( Open Street Maps ) and write the code yourself. Next - if you are going to do this for a large area, I would suggest an approach like I recommended here with grids: fooobar.com/questions/1480215 / ...
I would create grid elements, and for each street I calculated all the grids to which it belongs and store them in a database. Then, when you perform a polygon search, you compute all the grids that overlap the polygons, and then can test a subset of the road data in each of these squares to determine the overlap.
I reviewed this and rejected a similar requirement a few months ago and still want to implement it. Most of the points / lines in the polygon work on the data created in my application (i.e. not on the streets), and now this is the only data that I will include. What I'm trying to say is I hope someone gives you a better answer.
Update:
For what you ask, I still think that you will need to use a combination of your own OpenStreetMap-based database and some kind of grid analysis done in advance. If you have time to complete a project, this should not be too terrible to process. The database will be large and required calculations will require a significant amount of one-time / pre-processing time. Regarding the allocation of routes / roads / regardless of the viewing area, there are many ways to do this using the API example that I found useful: the polyline is attached to the road using google api v3 maps
Also useful: http://econym.org.uk/gmap/snap.htm
Note that one-way streets can give some grief if you use the api directions to click on the street, and you may have to keep track of this and correct or discard the start / end points.
source share