1

There is a way to convert a distance (in kilometers) into a float zoom level of a GMSCameraPosition?

I have an app where the user specifies a diameter (in kilometers) that he wants to see around the gps checkmark (his position). So, I need to convert that distance (like, 30 km) into a zoom level that fits that distance in kilometers.

I'm very new with Google Maps and didn't find a way to that until now.

Thanks in advance.

reinaldoluckman
  • 6,317
  • 8
  • 42
  • 50

1 Answers1

2

For calculating with GPS coordinates have a look here. (Especially the section "Destination point given distance and bearing from start point").

When you have your coordinates you can use the fitBounds-method of the Map-object which does exactly what you want.

Joachim Rohde
  • 5,915
  • 2
  • 29
  • 46