Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top