i don't believe there is an api to do that. it's certainly doable but i believe you're going to have to do a lot of the work yourself:
1) draw a number of polygons and put them on the map. easy.
2) find the center of each polygon and make that a waypoint. should be easy.
3) calculate the directions. feed to google directions api (taking into account the 25 waypoints limit per request). easy.
4) lay the route over the polygons. easy.
the polygons and the directions are 2 separate routines. when you lay one over the other, it will appear as if you're giving directions from a polygon. easy.
sorry, i forgot it sounds like you don't want to use google's directions api. find another (there are a number out there). they will all give you the route in a form that you can feed to google maps called a polyline encoded string. if google maps complains, then you'll have to use its directions api.
Last edited: Aug 23, 2020
"A little kindness - as little as required by applicable law."
"It can't hurt to read the thread before replying."
"Show code; code always does what you tell it to do, not always what you tell us it does."