1

I'm currently making an app that has some functionality that resembles navigation software (but no, I cannot use actual existing navigation software for this) and thus can track a person while they drive. For this I am trying to use google maps api v2, but it gets problematic once I go faster than approximately 50 km/hour.

At that point I basically drive off the map into the gray, and the loading of new tiles does not seem to keep nor catch up with my driving speed. At some points it goes ok for a while, I've even had moments on the highway where it kept up with 130 km/h, but these moments are very rare and generally my app becomes unusable after 50-60 km/h. This is all with the normal mapview, with Sat/Hybrid its of course even slower/worse. I've tried both 3g and 4g, my internet speed really is not the issue unless 15Mb/s is not fast enough.

Is there any way I can tell Google Maps to load tiles faster or cache more of its surroundings? Will a business license increase this speed? Or am I forced to start using OSM instead of Google Maps?

3
  • Do you use Directions API? Can you also provide code related to your issue?
    – ztan
    Feb 18, 2015 at 17:03
  • What methods are you using to track your device? Have you tried something like this
    – so_jin_ee
    Feb 18, 2015 at 17:16
  • I'm working on the same project with SanderE. No we're not using Direction API, we have pre-built routes that we display on the map. We're using Maps Api v2, and we just center our current location when a new location update becomes available. We do this by calling AnimateCamera(CameraPosition), which contains our new target (lat/lng) and bearing.
    – Stijn
    Feb 24, 2015 at 10:08

1 Answer 1

8

This turned out not to be a performance problem. We profiled the application and could not find a significant CPU or memory load. This made us suspect a different problem. After a dozen test drives, enabling/disabling parts of code everytime, we found out what the problem was.

We animate the camera to the new GPS position every time a new position came in. This happened every ~500ms.

AnimateCamera() does not have a specified default duration when you don't specify it as an argument. However, we found out the default duration in our case is longer than 500ms.

While animating, the map will not load new tiles. So in our case, we started a new animation every 500ms, and the animation lasted longer than 500ms (we suspect 2000ms), and thus the map was always in the "animating" state.

When we specified a 300ms animation duration, all tiles loaded correctly, even at (very) high speeds.

4
  • Maybe a bit too late but have you noticed that the animation is not linear, it eases. It creates an ugly "laggy" effect in my case as it constantly eases in and out. Did you face a similar case? If yes, how did you solve it? Jan 14, 2017 at 22:58
  • can you tell me how to statically define the animation time..?
    – user6602265
    Jul 13, 2017 at 6:43
  • We suffered the same "laggy" effect as Can describes. I am no longer on this project, and can't access source code, so I can't check the code to see how we did this, @Vishal
    – Stijn
    Jul 20, 2017 at 7:54
  • You solved my problem as well, and had it not been for this post, I would probably have spent a lot of frustrated time trying to figure it out, so thanks a lot!
    – JoeTaicoon
    Apr 29, 2020 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.