Highlight a area with Google Maps JavaScript API v

2019-02-20 12:51发布

问题:

I want to highlight a area like on the image below which is taken from Google Maps. Is this possible to accomplish with the current version of their API (v3)? If yes, how?

Thanks in advance.

回答1:

You need to know the vertices of the area and create a polygon based on them.

But dashed strokes currently are not supported by polygons, if you require to have a dashed stroke you must create a sequence of polylines with different stroke-colors based on the vertices.

A built-in method to highlight an area currently doesn't exist.