capacitor-community / capacitor-community/google-maps

Get LatLng bounds of mapview (NE/SE/NW/SW)

Open
#72 4 comments 2 reactions 0 assignees View on GitHub
enhancement
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.