Google-maps – Add “Search Area” outline onto google maps result


Last year, Google added search area outlines to its offerings as reported in many places, and visible on Google maps itself. For example here, and reported here and here.

To be explicit, this is when google adds an outline relating to the search query. If you were to search for a town, a post code, or a zip code, Google will highlight this region of the map. Example:

90210 Search on Google Maps

This was apparently not available via the API, and only through Google's own web properties.

Recently, I noticed some other domains using this functionality, for example on Twitter.

Is there a seperate API Twitter and other large organisations are using? Has this functionality been added, but is as yet undocumented? Or have I simply missed the announcement and can't find any docs?

Best Solution

As there is no yet solution offered by the Maps API and manually filling in coordinates is nobody's business, here's a gem of an alternative. Found this answer on the GIS website--absolute lifesaver (would've saved jurihandl a LOT of minutes drawing Calgary, above ;D):

You can get polygon coordinates in json for using with googlemaps using openstreetmap. Go to Search a place like "San Francisco, CA"

Click on "Details"

Look for OSM ID and copy it (control+c), example: 2018776

Paste the ID and download the JSON file

Source: GIS