Skip to content

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

@J-Gonzalez

Description

@J-Gonzalez

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:

    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,
        ]])
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions