I am trying to overlay an image on Google Maps in my iOS app using the Google Maps SDK (GMSOverlay). Instead of placing an image at a single coordinate (like with GMSMarker), I need to position an image using four exact corner coordinates, so that it scales and rotates correctly based on the map's zoom and rotation.
I found that GMSGroundOverlay allows placing an image on a map, but it seems to only support setting a center coordinate and a bounds size, which doesn’t give full control over four custom corners.
I used GMSGroundOverlay, but it only allows setting a north-east and south-west bound, not four custom points:
let southWest = CLLocationCoordinate2D(latitude: 37.7749, longitude: -122.4194)
let northEast = CLLocationCoordinate2D(latitude: 37.7849, longitude: -122.4094)
let overlayBounds = GMSCoordinateBounds(coordinate: southWest, coordinate: northEast)
let overlay = GMSGroundOverlay(bounds: overlayBounds, icon: UIImage(named: "myOverlay"))
overlay.map = googleMapView
This works but doesn’t let me precisely align the image to four corner coordinates.
How can I overlay an image on Google Maps in iOS using four exact coordinates (e.g., top-left, top-right, bottom-left, bottom-right)? Is there a way to use GMSOverlay or another Google Maps API method to achieve this?
Any suggestions or workarounds would be appreciated. Thanks!
Current Result -
Expected -
I want to replace the Polygon with image that's it.