26

Since Jan 2012, Google has started highlighting search areas in pick color. See the details here: http://googlesystem.blogspot.in/2012/01/highlight-areas-in-google-maps.html

Does anyone know if this can be programmatically done using google maps API 3? I would want to show my cities in the map highlighted as shown in the link above.

I have already tried the Geocode API where I search for a city. That API only gives me the lat and long information. It does not help me in plotting the city boundaries.

Himanshu Khurana
  • 585
  • 1
  • 7
  • 11
  • If you go through the code of Google Map Maker you will find a file similar to this (http://www.google.com/mapmaker?f=q&hl=en&q=yordon+center&output=js&gw=30&ll=41.934943%2C-88.776348&spn=0.001453%2C0.006459&z=18&vpid=1394074375923). Just view the source of the file and somewhere in there is the polygon information. – Steven10172 Mar 06 '14 at 05:24
  • possible duplicate of [Add "Search Area" outline onto google maps result](http://stackoverflow.com/questions/9706484/add-search-area-outline-onto-google-maps-result) – Jason C Apr 13 '15 at 09:21

2 Answers2

39

No. It's not available in the API.

(It may be available in the future. Features of Google Maps do migrate into the API, but Google don't make announcements in advance and no-one has a crystal ball.)

You would need to find the city boundaries and draw the line yourself. Boundary data is almost certainly public-domain for the US. Other jurisdictions may not be so forthcoming.

Andrew Leach
  • 12,945
  • 1
  • 40
  • 47
  • Thanks! As of now I am plotting a polygon to highlight the boundaries. When Google makes this feature available in API, it would be great!! – Himanshu Khurana Jun 26 '12 at 17:52
  • 1
    Has situation changed since this answer was posted? – Sangharsh Dec 31 '15 at 15:18
  • 2
    @Sangharsh While it's true the API has changed out of all recognition in 3½ years, I don't think Google have made this easy, if it's now possible at all. But comments are not the place; ask another question (referencing all the other relevant questions you can find, including this one. The sidebar will help there). – Andrew Leach Dec 31 '15 at 15:34
  • 1
    While I haven't seen any option from Google to do this in their API, [I found a solution to get the boundries of administrative areas here. Hope this helps!](http://stackoverflow.com/a/31865958/3084239) – radu-matei May 30 '16 at 13:04
  • This post is almost a year old now, any one know if feature been added to API yet? (Or any plans to do it) – True Solutions Apr 09 '17 at 20:27
2

Although a very old post my answer might help somebody out there as am landing on this post every time I query for bounding box:

Yes we can get the bounding box coordinates that google is using to highlight a region using Googles geocoding service. check for the response of the API call in the below sample from Google.

https://developers.google.com/maps/documentation/javascript/examples/geocoding-simple?refresh=1

Mahesh Budeti
  • 374
  • 1
  • 16
  • 1
    No, geocoding only provide point lat long, no polygon outline provided – hoogw Mar 28 '18 at 17:20
  • 1
    check the response of Gmap API you can see north east and south west coordinates. – Mahesh Budeti Apr 04 '18 at 15:21
  • 1
    Thanks, Mahesh! This was all I needed since I was just trying to get the city within view of the Map. It doesn't return a polygon, but at least it does the bounds! – ihodonald Jun 10 '19 at 05:42