cordova-plugin-googlemaps icon indicating copy to clipboard operation
cordova-plugin-googlemaps copied to clipboard

Calculate zoom level to include GPS points and user's location

Open JeffreyJamesAttenti opened this issue 9 years ago • 2 comments

I'm submitting a ... (check one with "x") [x] question [ ] any problem or bug report [ ] feature request

If you choose 'problem or bug report', please select OS: (check one with "x") [ ] Android [ ] iOS

cordova information: (run $> cordova plugin list)

cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-console 1.0.7 "Console"
cordova-plugin-datepicker 0.9.2 "DatePicker"
cordova-plugin-device 1.1.3 "Device"
cordova-plugin-dialogs 1.3.0 "Notification"
cordova-plugin-googlemaps 2.1.2-beta-20171120-1042 "cordova-plugin-googlemaps"
cordova-plugin-network-information 1.3.0 "Network Information"
cordova-plugin-splashscreen 4.0.0 "Splashscreen"
cordova-plugin-statusbar 2.2.0 "StatusBar"
cordova-plugin-vibration 2.1.2 "Vibration"
cordova-plugin-whitelist 1.3.0 "Whitelist"
cordova-plugin-x-toast 2.5.2 "Toast"
cordova-sqlite-storage 0.8.2 "Cordova sqlite storage plugin (core version)"
uk.co.workingedge.phonegap.plugin.launchnavigator 3.2.1 "Launch Navigator"

Question: Is there a way to calculate a zoom level based on an array of latLng objects or a LatLngBounds object? I'm trying to zoom in to include a set of points and the user's location. I can figure out center with LatLngBounds but not sure on how to calculate the zoom level. Does the plugin have a function that helps with the zoom calculation?

JeffreyJamesAttenti avatar Nov 20 '17 20:11 JeffreyJamesAttenti

As far as I tested, the code of the most voted is not accurate, but mostly closed value to the actual zoom level. (I tested it when I developed the marker cluster function)

Since mostly fine, but very deep case, the value is different with the actual zoom level. That's why I didn't implement it.

wf9a5m75 avatar Nov 20 '17 21:11 wf9a5m75