'How to get polygon co-ordinates for a location searched on google maps. Maps API

I want to know if there is any way to get a city/suburb/postal code's outer boundary coordinates, so as to be able to draw a polygon on the map.

I have read through the google maps API documentation (Places, Maps, and Routes) and I can't find anywhere where they provide this information.

Native in google maps if you search for a city google maps will draw a polygon around the city edges. Drawing the polygon is not the issue I just want to know how to get the polygon points for any given location.

I have searched and all the available answers are either very old or provided only a community maintained polygon database, that is not guaranteed to have your location mapped.

So my question is, do google maps APIs expose some function to get these coordinates, or is there some reputable well maintained service where this information can be obtained from?

I am using it in a flutter applicant making use of google_maps_flutter.

These are some of the resources and other links I found but seem dated.

Resource 1

Resource 2

Googles Docs

Please please help.

enter image description here



Solution 1:[1]

I'm not sure that the Google Maps API offers this functionality, but I trust that you've dug through enough of their documentation to find that they don't.

I suggest looking at Nominatim, which queries data from OSM (OpenStreetMap). They're free to use and community-driven - which can be both awesome and scary (eg. you can't assume "permanent ID"s for the things you query)

Relevant Links:


Otherwise, you could also try looking for other tools that allow you to download datasets of boundary coordinates (eg: GADM) but you'd have to find one that has the level of granularity you need and read up on their usage policies (most disallow use for commercial purposes).


Unfortunately the world of GIS and digital cartography is one that can get pretty complicated and that I'm no expert in, but I hope this helps somewhat.

Listing other resources I've found that are rather outdated, but could still be helpful:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ad2969