capacitor-community / capacitor-community/google-maps
Get LatLng bounds of mapview (NE/SE/NW/SW)
- Dominant language
- Java
- Stars
- 161
- Forks
- 65
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
Corner bounds are extremely useful when needing to query the viewport to get points within the view.
**Does this feature exist in the Google Maps SDK for android and iOS? Please link the documentation for this feature.**
Yes, using "visible region"
https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/VisibleRegion?hl=en
**Describe the solution you'd like**
Either a getBounds function, or a way for all map events, such as on "didChange" to return bounds in addition to zoom level and center point lat/lng.
**Additional context**
Example swift code on didChange event that gets this data:
``` swift
public func mapView(_ mapView: GMSMapView, didChange position: GMSCameraPosition) {
self.notifyListeners("didChange", data: ["result": [
"position": [
"latitude": position.target.latitude,
"longitude": position.target.longitude
],
"bounds":[
"farLeft": [
"latitude": mapView.projection.visibleRegion().farLeft.latitude,
"longitude": mapView.projection.visibleRegion().farLeft.longitude,
],
"farRight":[
"latitude": mapView.projection.visibleRegion().nearRight.latitude,
"longitude": mapView.projection.visibleRegion().nearRight.longitude,
]
],
"zoom": position.zoom,
]])
}
```
Contributor guide
Assessment
This issue has not been assessed yet.