Swift: how to find out the top right and bottom left coordinates of a google map

I need to know the top right and bottom coordinates on the left of the google map every time the camera moves. The API gives me the center point of the camera. Is there a way to get what I want using the API or using some algorithm that knows the center point (target), scaling and bearing?

func mapView(mapView: GMSMapView, didChangeCameraPosition position: GMSCameraPosition) {
    position.target
    position.zoom
    position.bearing

}
+4
source share
2 answers

Swift 3

Use the GMSProjection method visibleRegion .

let projection = mapView.projection.visibleRegion()

let topLeftCorner: CLLocationCoordinate2D = projection.farLeft
let topRightCorner: CLLocationCoordinate2D = projection.farRight
let bottomLeftCorner: CLLocationCoordinate2D = projection.nearLeft
let bottomRightCorner: CLLocationCoordinate2D = projection.nearRight

Check out this question .

+4
source

How to find the top right and bottom left coordinates of google map

iOs GMSCoordinateBounds . northEast southWest .

  • (id) initWithCoordinate: (CLLocationCoordinate2D) : (CLLocationCoordinate2D) coord2 - , , . , coord1 to coord2 ;

Github repo , .

+2

All Articles