Reputation: 47
I am trying to use GroundOverlay to add an image to my map. I'm working with the example from
which is given like this
GoogleMap map = ...; // get a map.
BitmapDescriptor image = ...; // get an image.
LatLngBounds bounds = ...; // get a bounds
// Adds a ground overlay with 50% transparency.
GroundOverlay groundOverlay = map.addGroundOverlay(new GroundOverlayOptions()
.image(image)
.positionFromBounds(bounds)
.transparency(0.5));
However I don't know how to get the image as a bitmapdescriptor. I also don't know how to input the latlngBounds. Any help would be appreciated, the only tutorials I can find online are for API v.1 and no longer seem to work.
Upvotes: 2
Views: 8959
Reputation: 22232
BitmapDescriptorFactory can create BitmapDescriptor
s for you from various objects, e.g.
BitmapDescriptor image = BitmapDescriptorFactory.fromResource(R.drawable.myimage);
You don't need to use positionFromBounds
if you don't want to. There are alternative ways to create from central LatLng
and width in meters: GroundOverlayOptions.position.
Upvotes: 5