Search code examples
iosobjective-cgoogle-mapsgoogle-polyline

how to get specific area co-ordinates in google map


I have an app where we need to show the area selected based on the co-ordinates that we get from google map.

I know we can draw area using Polyline, however I am not getting from where I will get all latitude/ longitude for the specific area.

E.x. when I search for 85281, below is the result I get.

enter image description here

We are looking for a way that Zillow Rentals have applied in the app.

enter image description here


Solution

  • Currently Google Maps API doesn't expose any boundaries of geographic features. There is very old feature request in the Google issue tracker to add this functionality, however it looks like Google didn't set high priority on this task:

    https://issuetracker.google.com/issues/35816953

    Feel free to star the public feature request to express your interest and subscribe to notifications.

    Also, you can find a workaround to get polygons from other sources and add them to Google maps as additional layers.

    The nice workaround to get polygons in GeoJSON format from OSM is described in the following answer:

    https://stackoverflow.com/a/40172098/5140781

    So, if you download the GeoJSON you will be able to add it to map:

    https://developers.google.com/maps/documentation/ios-sdk/utility/kml-geojson#render-geojson-data

    I hope this helps!