1

I have a map I would like to show the User's Location when the location of the user is part of the map.. However I don't want it to pan the mapview to the users location with every update. How do I go about accomplishing this?

It seems as though enableMyLocation, automatically forces the map to scroll to the user location if it is offscreem, every time the GPS updates, which I do not want.

I would really like to leverage the built in MyLocationOverlay, rather than have to create my own, and it seems like telling it to keep updating itself and draw itself when it is on the visible map, but not scroll the map when it is not should be a simple flag or something, but I don't see anything in the API documentation.

Am I missing it? Or is this just not possible?

user756212
  • 522
  • 5
  • 16

1 Answers1

0

The thing your looking for would be:

myMapView.showUserLocation=false;

At least if I am reading it correctly that is.

  • No, that's not exactly it, I want the location Overlay to appear which showUserLocation allows, but I didn't want the map recentering when the location was out of screen, or recenter with every GPS update. I did resolve this issue. – user756212 May 27 '11 at 18:45
  • Well I think I did anyway, I've been working on a few other things recently. Will update this question when I confirm it is working – user756212 May 27 '11 at 18:49
  • Actually I am now in a strange state.. I used MyLocationOverlay and added it to the mapview overlays... and it shows the user location, and if the user location is VISIBLE on the map when a GPS update comes it it will scroll the mapview.. .however if I scroll the map away from the userlocation and then send a new GPS coordinate it does not scroll the mapview to the new user location. I am using the emulator, so who knows how this will behave on a real device, but it seems as thoug the mylocationoverlay has some sort of flag that is turned on or off in terms of panning the mapview – user756212 May 27 '11 at 18:58
  • based on whether it is currently visible. I'll have to dig some more. – user756212 May 27 '11 at 18:59
  • I find this in the documentation: – user756212 May 31 '11 at 14:36
  • Optionally, the constructor can also take a MapController and use it to keep the "my location" dot visible by panning the map when it would go offscreen, and a View to View.postInvalidate() when location or orientation is changed. However I am not passing in a MapViewController to the constructor, just the MapView... – user756212 May 31 '11 at 14:37