Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize the download of the tiles #9

Open
array81 opened this issue Oct 1, 2021 · 7 comments
Open

Optimize the download of the tiles #9

array81 opened this issue Oct 1, 2021 · 7 comments
Assignees

Comments

@array81
Copy link

array81 commented Oct 1, 2021

Now if I click on zoom (+) many tiles the library download all tiles for all zoom number. Besides I have to wait for it to finish doing something else, for example pan.
Is possible change the library to:

  • Allow you to change zoom or pan without waiting for the download to finish (now I need wait for it to finish download);
  • Make your library smarter: if the user change view (zoom and/or pan) while it is downloading tiles, stop the old download (of tiles no longer needed) and download the ones actually needed for the new view.
@Fr0sT-Brutal
Copy link
Owner

the library download all tiles for all zoom number

That's not quite so. Map is smart enough to download only a fragment (current viewport + some border around it). You can check it with demo and a zoom level >=4. But yes, all queued tiles remain even if you change zoom further.

Allow you to change zoom or pan without waiting for the download to finish (now I need wait for it to finish download)

I'm not sure I understand you. Map is completely responsible even if it has no tile image. Do you mean prioritizing tiles to those which fall into current viewport?

if the user change view (zoom and/or pan) while it is downloading tiles, stop the old download (of tiles no longer needed) and download the ones actually needed for the new view

Yep, that's possible and seems not hard to implement

@Fr0sT-Brutal Fr0sT-Brutal self-assigned this Oct 1, 2021
Fr0sT-Brutal added a commit that referenced this issue Oct 1, 2021
…les when a tile with another zoom level is requested (as suggested in #9) to make map viewable ASAP when a user zooms in/out quickly through multiple levels.

+ TNetworkRequestQueue.DumbQueueOrder to return old behavior
@Fr0sT-Brutal
Copy link
Owner

Fr0sT-Brutal commented Oct 1, 2021

The simplest is done, two are in TODO

  • Cancel zoom level if another is requested
  • Prioritize tile requests to current viewport (additional parameter to TNetworkRequestQueue.RequestTile - but TQueue seems not having a way to do so)
  • Only request tiles after scrolling stays for some time (skip requesting all ones which were scrolled by quickly)

@array81
Copy link
Author

array81 commented Oct 1, 2021

I'm not sure I understand you. Map is completely responsible even if it has no tile image. Do you mean prioritizing tiles to those which fall into current viewport?

If component download tiles it is difficult to move the map.

@AlexHausauer
Copy link

Если Вы хотите, чтобы быстрее загружалась видимая часть карты, то измените в файле "osm.mapcontrol.pas" константы на: CacheImageDefTilesH=1;
CacheImageDefTilesV=1;
CacheMarginSize=1;
Я сделал так, отображает необходимую часть карты значительно быстрее.

@Fr0sT-Brutal
Copy link
Owner

Fr0sT-Brutal commented Oct 4, 2021

If component download tiles it is difficult to move the map.

This is weird. Download is almost completely untied with map drawing. It should scroll smoothly regardless of the available tiles displaying stubs instead. What OS you're on? What happens if you disable network (or set non-existing proxy address)?

For now you can shrink the cache as Alex said, this will reduce the number of tiles downloaded for each single view. Later this trick will become less actual (when tile prioritizing is done)

@Fr0sT-Brutal
Copy link
Owner

Fr0sT-Brutal commented Oct 4, 2021

@array81 I just checked fast panning with Demo. All glitches come from line Log(Format('Queued request from inet %s', [TileToStr(Tile)])); in TMainForm.mMapDrawTile. Disabling it makes panning smooth, both with already cached tiles and requested from inet.

@Fr0sT-Brutal
Copy link
Owner

Fr0sT-Brutal commented Oct 4, 2021

Prioritizing done in 9f6e2dd

@Fr0sT-Brutal Fr0sT-Brutal mentioned this issue Oct 8, 2021
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants