mousebird-consulting-inc / WhirlyGlobe

WhirlyGlobe Development
Other
830 stars 255 forks source link

Strange behaviour with custom TileProvider (Android) #486

Closed jmcazaux closed 8 years ago

jmcazaux commented 8 years ago

I am pursuing experiments and now that I am past displaying remote maps, I am trying a local map based on a custom source (some clipping/image merging is necessary, so it has to be custom).

Anyway, in a nutshell, my custom source get tiles from a local directory. As I had strange results, I have added some logs when a tile is queried and how long it takes to render.

What I see is that it takes a lot of time before the tiles are requested.

When I change the position (view port or zoom) the part of the screen that needs updating remains black (clearColor) for a while (more than 10 seconds), then I get a bunch of tile queries. I fling or zoom again, I have a lot of black, and so on...

My source render each tile in 5 to 9 ms so I assume there is nothing wrong here...

Any hint on where to investigate and what to look for ?

Thanks, JM

mousebird commented 8 years ago

In your startFetchForTile() make sure not to block. Do all your work on another thread and then merge it back in on the layerThread for that QuadImageTileLayer.

jmcazaux commented 8 years ago

This is what I am doing.

The actual leg work is done in an AsyncTask that is triggered by the startFetch.

I have just added some logs. It seems that startFetch is not called "enough"...

JM

mousebird commented 8 years ago

How many simultaneous fetches do you have it set to?

jmcazaux commented 8 years ago

4

mousebird commented 8 years ago

I'm not sure. The Android version is still fairly new and can exhibit some strange behavior.

Is there any chance you could put together a simple example for the AutoTester so we can duplicate this?

jmcazaux commented 8 years ago

I will try that, but that is a lot of code to move over...

In the mean time here are some logs that exhibit the issue. https://gist.github.com/jmcazaux/fd77daa793112daf9964

mousebird commented 8 years ago

Android Bugs

jmcazaux commented 8 years ago

You can easily reproduce this one by pulling https://github.com/mousebird/WhirlyGlobe/pull/487 or cloning my repo.

mousebird commented 8 years ago

Two problems I see. minZoom/maxZoom are reversed. lon/lat were reversed. But even when I fix them it doesn't seem to be quite right place for the tiles. They are trying to load now, though.