Take the 2-minute tour ×

I'm trying to centre a 40x40 marker at a lat/lon position in an itemizedOverlay for a mapview.

I set the marker bounds with

    markerDefault.setBounds( -markerDefault.getIntrinsicWidth()/2
            , markerDefault.getIntrinsicWidth()/2
            , markerDefault.getIntrinsicHeight()/2);

When I check the lat/lon by tapping the centre of the marker image, the lat seems to be wrong by about the height of the image.

Is there a way to ensure the image is centred at the required lat/lon?

Is it possible the default mouse cursor - an arrow - isn't doing its usual behaviour of using its pointy end to interact with the emulator?



share|improve this question
What mouse cursor? –  Falmarri Jan 5 '11 at 0:58
I'm using the emulator, so the 'tap' is actually a mouse click. I use the onTap(GeoPoint p, MapView mapView) method to detect the point and get the lat-lon from p. –  Geoff Jan 5 '11 at 3:43

1 Answer 1

The answer -

I'm using an ItemisedOverlay. When an OverlayItem is added, you can specify whether the marker is positioned with its centre at the position, or its lower edge at the position. See ItemizedOverlay.

I had copy-and-pasted some nice code for an ItemizedOverlay I found( on stackoverflow of course), which included


This caused the apparent anomaly I found. Its good if you're using a pin-type marker tho. I changed it to


and it works as expected.

share|improve this answer

Your Answer


