user2771655
user2771655

Reputation: 1082

GroundOverlay is not displaying but marker is displaying in Android GoogleMap v2

I am moving from Android googlemap v1 to v2. I found that to display my own icons I have to use GroundOverlay(In v1 I used Overlay ) Is there any other good solution?

  1. Can I update the GroundOverlay location whenever I receive the location updates? (move the object) Google says "A ground overlay is an image that is fixed to a map"
  2. Even if I add GroundOverlay I don't see it in my map. It just locate to Africa. No Icon. When I add Marker I can see that. But not GroundOverlay.

     BitmapDescriptor image = 
     BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE);
     LatLngBounds bounds = new LatLngBounds (new LatLng(00.00, 00.00), new LatLng(00.00, 00.00)); // get a bounds
    
     GroundOverlayOptions goo = new GroundOverlayOptions();
     goo.image(image);
     goo.positionFromBounds(bounds);
     goo.transparency(0);
     goo.visible(true);
     // Adds a ground overlay with 50% transparency.
    
     GroundOverlay groundOverlay = googleMap.addGroundOverlay(goo);
    

I have a demo in 2 days I really want this to work. Please help.

Upvotes: 2

Views: 2511

Answers (2)

user2808624
user2808624

Reputation: 2530

The ground overlay is something that behaves as if it is laying on the ground. So it will be turned, zoomed etc. together with the map. So why do you prefer ground overlay over markers if you want to work it like a marker? You can use your own image also for a marker:

    BitmapDescriptor image = ....;
    MarkerOptions options = new MarkerOptions();
    options.position(coordinate);
    options.icon(image);
    googleMap.addMarker(options);

Upvotes: 0

user2771655
user2771655

Reputation: 1082

I found the problem. The problem is with the zoom. The GroundOverlay is very small to see.

final LatLng cordination = new LatLng(40.714086, -74.228697);

goo.position(cordination, 500000f);

Now my problem is when I zoom the map. The GroundOverlay also zooming. I want this not to zoom and work like a Marker. Any one know how to do Pls respond.

Upvotes: 1

Related Questions