I am working with Google maps and I am able to center the map to the GMSMarker by using
GMSCameraPosition *camera =
[[GMSCameraPosition alloc] initWithT
Swift 4, 3
func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
var point:CGPoint = mapView.projection.point(for: marker.position)
point.x = point.x + 100
let camera:GMSCameraUpdate = GMSCameraUpdate.setTarget(mapView.projection.coordinate(for: point))
mapView.animate(with: camera)
return true
}
Have a look at using GMSProjection. To shift the center of the map 100px from the markers location you would do something like:
- (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker {
CGPoint point = [mapView_.projection pointForCoordinate:marker.position];
point.x = point.x + 100;
GMSCameraUpdate *camera =
[GMSCameraUpdate setTarget:[mapView_.projection coordinateForPoint:point]];
[mapView_ animateWithCameraUpdate:camera];
return YES;
}