Search code examples
google-maps-api-3highlight

Highlight a area with Google Maps JavaScript API v3


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?

google-maps-highlight

Thanks in advance.


Solution

  • 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.