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

Preload tiles from an array of latlngs ? #170

Closed
ibrierley opened this issue Nov 19, 2018 · 4 comments
Closed

Preload tiles from an array of latlngs ? #170

ibrierley opened this issue Nov 19, 2018 · 4 comments

Comments

@ibrierley
Copy link
Collaborator

I can see in the code there is a call to load an image/url depending on a point in the tilemap layer.

One thing I was wondering about, was the ability to preload a set of images, based on an array of latlongs, or an area (eg topleft, bottomright).

Reasoning is, I'm developing an app where offline is needed, and currently before I go ofline, I drag around a certain area to load the images into cache. Then the map works offline.

I'm unsure if this should be part of the core flutter_map though, as it feels like it could easily be abused (downloading too many tiles). Maybe there could be a delay added to be kind to the tileservers and a max tiles restriction ? I looked a the plugin lib, but didn't see how I could manage via that to access the tilelayer code.

Completely understand if it's not desirable.

@johnpryan
Copy link
Collaborator

Have you checked out the offline tile example? I suspect that will work for your use-case.

@ibrierley
Copy link
Collaborator Author

Yes, I checked that, but if I read that right, it needs to be done manually, rather than something integrated. I'll take a look separately and feed back if I manage something.

@gimox
Copy link
Contributor

gimox commented Nov 19, 2018

I think that a sort of preloading and casching is a good think. So offline map are good only for limited zone where tiles are very light under 100mb. So i m thinking something like:

  • caching loaded tiles
  • preloading others tiles near visibile area for a smooth gestures

What about start using cachednetworkimage plugin?

@ibrierley
Copy link
Collaborator Author

Am going to close this, although I still think it would be useful, especially using flutter_cache_manager, but it became too fiddly for me.

Just for info, I've gone with my own solution which lets me select an area via latlngs, download the tiles in advance (after deleting old set from a custom directory) using http.get & Io.File..writeAsBytesSync, and then if the app detects no data available, it changes fluttermap offline mode and uses a local urlTemplate, if there is data it uses a remote urlTemplate.

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