Search code examples
iosgoogle-mapsmapkitgisgoogle-maps-sdk-ios

Center USA cities on iOS app


Based on a city name, like San Diego, we need to center map on that city in the iOS application.

We thought on using top left coordinates and botton right coordinates for each city, however this cannot be automated. Another solution was taking the center of the city based on data from Google Maps, however we need to define a zoom for each city that must depend on it's boundaries.

What approaches can you think? How can we define the zoom for the second approach?

Thanks


Solution

  • Have you tried using the viewport JSON output of the Google Geocoding API? It contains the northeast and southwest coordinates that you can pass into fitBounds.